how does the integration test and unit test relevant in doing testing on APIController? and how can i mock the repository while creating the webrequest in the integration test so it does not make an actual query to the database?
You can use the Self Hosting functionality to start up the controllers and use the OpenAsync().ContinueWith(t => { /* ... */ })
function to run your tests. You'll want to override the Configuration.DependencyResolver
and override the IHttpControllerActivator
so that you can specify your own mock implementation (e.g. you can use Ninject to retrieve the specific controller already bound up with a mock implementation).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With