Is there a way to unit test or debug a web api in one vs solution? I am consuming the WebAPI using HttpClient and have two instances of VS up to do this.
in 1 VS instan
In the current version of ASP.Net Core the official solution to this is to use the Microsoft.AspNetCore.TestHost Nuget assembly which creates a simulated web server hosting the web project in the test project.
Details on usage can be found here: https://docs.microsoft.com/en-us/aspnet/core/testing/integration-testing
On the one hand it feels like a bit of a fudge because by what definition is it genuine integration testing if a real web server is not involved, on the other hand it does at least work pretty seamlessly once you get it set up.