Reputation: 2984
I'm currently trying to unit test an ApiController
I've created.
What I'm stumbling over is that for some reason I can't "use" System.Web.Http
. In my main project though I can use the using
without any problem (and thus use IHttpActionResult
).
Now what I'm not getting is why is it not possible in the unit test Project? Am I overlooking here something or do I need to do something differently?
Upvotes: 1
Views: 2198
Reputation: 3107
As suggested here, System.Web.Http
can be installed via NuGet
Get-Project MyTestProject | Install-Package Microsoft.AspNet.WebApi.Core
I tested it in my Unit Test Project and it worked, actually downloading it. .
After all, the System.Web
namespace doesn't seem to contain any Http
member.
Anyway, since you said in the comments section that you already had System.Web.Http
in your references, off the top of my head I'd say that maybe some dependencies were missing before installing the NuGet package.
WebApi.Core
depends on
A very, very similar question was also asked here.
Upvotes: 4