I have a unit test that worked fine in MVC2. The test simply determines the action on the controller, the necessary stubs, and checks the name of the view. However, after upgrading to MVC3, when I call the method, I get the error above. Updating the MVC3 site works fine; Due to the update, I just refuse these unit tests. Thanks.
Here is 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 is the test. It does not work when it returns a view from an 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); }
source share