I have a unit test that worked fine in MVC2. The test simply defines the Action on the controller, the necessary stubs, and tests the name of the view. However, after upgrading to MVC3, when I invoke the method, I get the error above. The site MVC3 upgrade works just fine; I just have these unit tests failing due to the upgrade. Thanks.
Here's my action:
public partial class GadgetController
{
[SetterProperty]
public IATCGadgetProxy ATCGadgetService { get; set; }
public ActionResult LoadForums(bool popularOnly, bool myThreads, int itemCount)
{
var model = ATCGadgetService.LoadForums(popularOnly, myThreads, itemCount);
return View("AskTheCommunity-Forums", model);
}
}
Here's the test. It is failing when it's returning the view from the Action.
[TestMethod]
public void Test_Forums_Action_Type()
{
GadgetController controller = new GadgetController();
controller.ATCGadgetService = new ATCGadgetServiceStub();
ViewResult result = controller.LoadForums(false, false, 10) as ViewResult;
Assert.IsNotNull(result);
Assert.AreEqual("AskTheCommunity-Forums", result.ViewName);
}