Integration test and unit test (WEB API mvc 4)

How does the integration test and unit test matter when testing on APIController? and how can I mock the repository when creating a web request in an integration test so that it does not make the actual database request?

+5
source share
1 answer

You can use Self Hosting to run controllers and use the function OpenAsync().ContinueWith(t => { /* ... */ })to run your tests. You want to override Configuration.DependencyResolverand override IHttpControllerActivatorso that you can specify your own layout implementation (for example, you can use Ninject to get a specific controller that is already associated with the layout implementation).

+5

All Articles