I have problem with unit testing my WEB API controller, I\'m using moq to mock up my repository, do the setup and response for it. Then initiate the controller with mocked r
Check your packages.config , Make sure that the following Nuget packaged libraries are at the same version:
<package id="Microsoft.AspNet.WebApi" version="x.x.x" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="x.x.x" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="x.x.x" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="x.x.x" targetFramework="net45" />
Uninstall-package from WebApi, WebApiWebhost, WebApi.Core, WebApi.Client
PM> uninstall-package Microsoft.AspNet.WebApi
PM> uninstall-package Microsoft.AspNet.WebApi.WebHost
PM> uninstall-package Microsoft.AspNet.WebApi.Core
PM> uninstall-package Microsoft.AspNet.WebApi.Client
Reinstall-package,
PM> install-package Microsoft.AspNet.WebApi -version x.x.x
Try ensuring that Microsoft.AspNet.WebApi.Client is installed.
My app wasn't working because I'd removed that for other reasons.
Open Package Manager Console and execute:
Install-Package Microsoft.AspNet.WebApi.Client
Make sure that the following Nuget packaged libraries are at the same version:
Microsoft.AspNet.WebApi
Microsoft.AspNet.WebApi.Client
Microsoft.AspNet.WebApi.Core
Microsoft.AspNet.WebApi.WebHost