public void Step1_Returns_View() { // Arrange AnalysisController analysis = GetAnalysisController(); // Act ActionResult view = analysis.Step1(analysis.ControllerContext.HttpContext.User); // Assert Assert.IsInstanceOf(typeof(ViewResult), view); }
public void Step1_Submit_Returns_View() { 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 }; Step1Model model = new Step1Model { HasSchoolID = false, HasDistrictID = false, HasStateID = true, RadioStates = list.ConvertAll( i => new CheckboxItem { Label = "New Mexico", Value = "NM", Checked = false }), State = "New Mexico" }; // Act var action = (RedirectToRouteResult)analysis.Step1("Submit", model, analysis.ControllerContext.HttpContext.User, 1); // Assert Assert.IsInstanceOf(typeof(ActionResult), action); //Assert.AreEqual(action.RouteValues["action"], "Step1b"); //Assert.AreEqual(action.RouteValues["controller"], "Analysis"); var result = (RedirectToRouteResult)analysis.Step1("Back", model, analysis.ControllerContext.HttpContext.User, 1); // Assert //Assert.AreEqual(result.RouteValues["action"], "Index"); //Assert.AreEqual(result.RouteValues["controller"], "Home"); }