I am trying to use OWIN for the Self-Host Web API during the execution of my tests, and I want to run it in BeforeEach and dwell on AfterEach methods.
All the examples I found suggest using the using keyword, for example.
using (WebApp.Start<Startup>(url: baseAddress)) { ... }
But in my case, this does not help.
I tried to do like this:
private IDisposable _webApp; public override void BeforeEach() { _webApp = WebApp.Start<OwinStartup>("http://localhost:99999/"); } public override void AfterEach() { base.AfterEach(); if (_webApp != null) _webApp.Dispose(); }
But for some reason, it calls the Dispose method of the UnityResolver class, and then I get a stackoverflow... exception stackoverflow...
How to host an OWIN host?
source share