I want to run tests against WebAPI project using a popular in-memory hosting strategy.
My tests reside in a separate project.
Here's the start of my test
[TestMethod]
public void TestMethod1()
{
HttpConfiguration config = new HttpConfiguration();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new {id = RouteParameter.Optional});
HttpServer server = new HttpServer(config);
HttpMessageInvoker client = new HttpMessageInvoker(server)
}
The client is initialized with the HttpServer, establishing the direct client-server connection.
Other than providing route config info, how does HttpServer know which WebAPI project to host?
How to host multiple WebAPI projects at the same time?
Seems HttpServer does some magic to locate WebAPI projects?
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…