I created a Unit Test project using Visual Studio 2013 Express for Web.
and my test is this
[TestMethod]
public void it_should_return_the_home_view()
{
// arrange
HomeController controller = new HomeController();
// act
ViewResult result = controller.Index() as ViewResult;
// assert
Assert.IsTrue(string.IsNullOrEmpty(result.ViewName));
}
My HomeController has this action method:
public ActionResult Index()
{
ViewBag.Message = "Welcome!";
return View();
}
When I run the test above an exception occurs at "return View()"
The exception message is "An exception of type 'System.TypeInitializationException' occurred in System.Web.Mvc.dll"