public void Step1B_Submit_Returns_View() { // Arrange AnalysisController analysis = GetAnalysisController(); var st1 = new State { FullName = "New Mexico", Id = 1, StateAbbrev = "NM", StateId = 1 }; var list = new System.Collections.Generic.List <State>() { st1 }; var uploadFile = GetMockUploadFile("UploadTestFile"); Step1BModel model = new Step1BModel { ParticipantFile = "C:\fakedir\fake\fakefile.csv", ParticipantText = null }; // Act var action = (RedirectToRouteResult)analysis.Step1b("Submit", model, uploadFile, analysis.ControllerContext.HttpContext.User, 1); // Assert Assert.IsInstanceOf(typeof(ActionResult), action); Assert.AreEqual(action.RouteValues["action"], "Step2"); Assert.AreEqual(action.RouteValues["controller"], "Analysis"); action = (RedirectToRouteResult)analysis.Step1b("Submit", model, uploadFile, analysis.ControllerContext.HttpContext.User, 2); // Assert Assert.IsInstanceOf(typeof(ActionResult), action); Assert.AreEqual(action.RouteValues["action"], "PermissionDenied"); Assert.AreEqual(action.RouteValues["controller"], "Error"); var result = (RedirectToRouteResult)analysis.Step1b("Back", model, uploadFile, analysis.ControllerContext.HttpContext.User, 1); // Assert Assert.AreEqual(result.RouteValues["action"], "Step1"); Assert.AreEqual(result.RouteValues["controller"], "Analysis"); Assert.AreEqual(result.RouteValues["id"], 1); model.ParticipantFile = null; result = (RedirectToRouteResult)analysis.Step1b("Submit", model, null, analysis.ControllerContext.HttpContext.User, 1); // Assert Assert.AreEqual(result.RouteValues["action"], "Step1b"); Assert.AreEqual(result.RouteValues["controller"], "Analysis"); Assert.AreEqual(result.RouteValues["id"], 1); }
public void Step1B_Returns_View() { // Arrange AnalysisController analysis = GetAnalysisController(); // Act ActionResult view = analysis.Step1b(analysis.ControllerContext.HttpContext.User, 1); // Assert Assert.IsInstanceOf(typeof(ViewResult), view); }