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 instance I have the unit test, in the second vs instance I have the webapi running in localhost.
Is there a better way to do this?
Is the preferred way to unit test is to have a reference to the WebAPI project?
I want to consume it using httpClient and not have to reference it in the UnitTest Project.
so in my UnitTest method it would have a baseAddress of "http://localhost:1234"
this would be where the WebAPI if launched from the same solution would be hosted.
The current way I am debugging requires me to launch a second Visual Studio instance with the same solution loaded and have one running the WebAPI project, while the other Visual Studio runs the Unit Test project.
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