Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing reference to System.Web.Mvc in Asp.net Unit Test?

I recently made some unit tests for my Asp.NET MVC application, or I tried to, it keep telling me "The type 'System.Web.Mvc.Controller' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral.' Then I tried to add a reference to the above mentioned, but was only able to choose version 4.0.0.0 and now it tells me that my project already uses version 5.1.0.0, which is a higher version. What to do?

Thanks a bunch!

like image 816
Recusiwe Avatar asked Jun 27 '14 21:06

Recusiwe


People also ask

How does MVC enable is of unit testing?

The ASP.NET MVC Framework makes it easy and natural to unit test application functionality. It also enables a Test Driven Development (TDD) workflow that enables test-first based development.

Is it possible to unit test an MVC application without running the controllers in an ASP NET process?

thanks! unit tests do not run in the "MVC environment." They will run within the scope of the test runner, be that nunit, resharper,....

What is unit test in ASP NET MVC?

Advertisements. In computer programming, unit testing is a software testing method by which individual units of source code are tested to determine whether they are fit for use.


1 Answers

MVC 5 comes in from a NuGet package. Just as it did with the main MVC web project in your solution. Install MVC via NuGet into your Test project, and you should be good to go.

like image 193
Jay Harris Avatar answered Oct 15 '22 05:10

Jay Harris