Open piccaso opened 6 years ago
I found a way to make it work (at least it seems that way for now).
By using reflection to change the HttpClient - which does not feel like a good idea :)
public void SetUp() {
var host = new WebHostBuilder().UseStartup<Startup>();
var server = new TestServer(host);
_httpClient = server.CreateClient();
_apiClient = new MyAPI();
_apiClient.GetType()
.GetProperty(nameof(_apiClient.HttpClient))
.SetValue(_apiClient, _httpClient);
}
I'm trying to find out how to do integration tests, here is my approach:
the whole file is here.
but that ist probably not the right way to setup an autorest client with a testhost...
Is there any documentation on this or an example?