Developer Support

Advocacy and Innovation

Unit Testing OData Web API/Entity Framework Applications

In this blog post, senior Premier Developer consultant Monu Bambroo demonstrates how to easily unit test an OData based Web API service which is consuming data from SQL DB using Entity Framework. The goal is to write unit tests which stub out the actual DB calls. We will make use of faking the DB Context and using a common DI pattern of construction injection. The result is a highly testable maintainable and cohesive codebase.