4

I have an integrationtest project and a web api project in the same solution. The integration tests use RestSharp to call the web api. When running the integration tests I want the web api project to launch first. Is that possible?

1 Answer 1

4

The best way I've found to do this is to Self Host the target WebApi project. Then, if you want to run these tests on a build server etc, you don't need a web server installed.

This is a pretty good walk-through on setting up a Self Host.

Essentially, you use the HttpSelfHostServer class with HttpSelfHostConfiguration to host the target project.

Sign up to request clarification or add additional context in comments.

3 Comments

Is it possible to use RestSharp client with HttpSelfhostServer?
Yeah, you will be speaking HTTP so any HTTP client will do. Self Hosting is like creating an in memory web server.
stackoverflow.com/questions/14698130/… suggests to use HttpServer over HttpSelfHostServer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.