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>
Just make sure that you are invoking any controller from the web api project into your separate project to ensure that web api project is loaded in in-memory.Example:
[TestMethod]
public void TestMethod1()
{
//// So that the web api project is loaded in-memory
{webapi Project name}.Controller.{controllerName} = new {controller name}() ;
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)
}