Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visual studio unit test project missing assemblies (while using Moq)

So I have a solution contains two project: Example.Api and Example.Api.Test.

Example.API project is my Web API 2 project that talks to Database.

Example.API.Test project is there to unit test against Example.API.

I'm using moq to mock the context and controllers and more.

One problem is that my Example.API.Test project misses a lot assemblies used by Example.API project.

Test project has reference to the Example.API project but all the system assemblies are missing.

for example, The type 'System.Web.Http.ApiController' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Http ...

I could add individual reference to Example.API.Test project but it seems not the right way.

Any tips available?

Thank you.

like image 729
CodeSchool JJ Avatar asked Oct 01 '14 19:10

CodeSchool JJ


1 Answers

Just Follow other's advice! Do Install-Package Microsoft.AspNet.WebApi.Core evenif nuget says it has it.

:)

Quote as Joseph told me "You can easily install the same version by managing packages (right click on the solution level)"

Thank you!

like image 189
CodeSchool JJ Avatar answered Oct 10 '22 20:10

CodeSchool JJ