public void Step2b_Get_Returns_View() { // Arrange AnalysisController analysis = GetAnalysisController(); // Act ActionResult view = analysis.Step2b(analysis.ControllerContext.HttpContext.User, 1); // Assert Assert.IsInstanceOf(typeof(ViewResult), view); }
public void Step2b_Submit_Returns_View() { // Arrange AnalysisController analysis = GetAnalysisController(); Step2BModel model = new Step2BModel { AnalysisDescription = "Desc", AnalysisName = "Name", GradeLevels = new System.Collections.Generic.List <CheckboxItem>() { new CheckboxItem { Label = "k", Value = "k", Checked = false }, new CheckboxItem { Label = "1", Value = "1", Checked = false }, new CheckboxItem { Label = "2", Value = "2", Checked = false }, new CheckboxItem { Label = "3", Value = "3", Checked = false }, new CheckboxItem { Label = "4", Value = "4", Checked = false }, new CheckboxItem { Label = "5", Value = "5", Checked = false }, new CheckboxItem { Label = "6", Value = "6", Checked = false }, new CheckboxItem { Label = "7", Value = "7", Checked = false }, new CheckboxItem { Label = "8", Value = "8", Checked = false }, new CheckboxItem { Label = "9", Value = "9", Checked = true }, new CheckboxItem { Label = "10", Value = "10", Checked = true }, new CheckboxItem { Label = "11", Value = "11", Checked = true }, new CheckboxItem { Label = "12", Value = "12", Checked = true } }, //InterventionAreas = new System.Collections.Generic.List<CheckboxItem> { new CheckboxItem { Label = "english", Value = "english", Checked = true }, new CheckboxItem { Label = "math", Value = "math", Checked = false }, new CheckboxItem { Label = "grad", Value = "grad", Checked = false }, new CheckboxItem { Label = "hs", Value = "hs", Checked = false }, new CheckboxItem { Label = "college", Value = "college", Checked = false }, new CheckboxItem { Label = "other", Value = "other", Checked = false } }, InterventionStartDate = (DateTime)SqlDateTime.MinValue, InterventionEndDate = (DateTime)SqlDateTime.MinValue, OutcomeMeasures = new System.Collections.Generic.List <CheckboxItem> { new CheckboxItem { Label = "english", Value = "english", Checked = true }, new CheckboxItem { Label = "math", Value = "math", Checked = false }, new CheckboxItem { Label = "grad", Value = "grad", Checked = false }, new CheckboxItem { Label = "hs", Value = "hs", Checked = false }, new CheckboxItem { Label = "college", Value = "college", Checked = false }, new CheckboxItem { Label = "other", Value = "other", Checked = false } }, SubgroupAnalyses = new System.Collections.Generic.List <CheckboxItem> { new CheckboxItem { Label = "gender", Value = "gender", Checked = true }, new CheckboxItem { Label = "race", Value = "race", Checked = false }, new CheckboxItem { Label = "ELL", Value = "ELL", Checked = false }, new CheckboxItem { Label = "ED", Value = "ED", Checked = false }, new CheckboxItem { Label = "disabilities", Value = "disabilities", Checked = false } } }; // Act RedirectToRouteResult action = (RedirectToRouteResult)analysis.Step2b("Submit", model, analysis.ControllerContext.HttpContext.User, 1); // Assert Assert.IsInstanceOf(typeof(ActionResult), action); Assert.AreEqual(action.RouteValues["action"], "Step3"); Assert.AreEqual(action.RouteValues["controller"], "Analysis"); action = (RedirectToRouteResult)analysis.Step2b("Submit", model, analysis.ControllerContext.HttpContext.User, 2); // Assert Assert.IsInstanceOf(typeof(ActionResult), action); Assert.AreEqual(action.RouteValues["action"], "PermissionDenied"); Assert.AreEqual(action.RouteValues["controller"], "Error"); action = (RedirectToRouteResult)analysis.Step2b("Back", model, analysis.ControllerContext.HttpContext.User, 2); // Assert Assert.IsInstanceOf(typeof(ActionResult), action); Assert.AreEqual(action.RouteValues["action"], "Step2"); Assert.AreEqual(action.RouteValues["controller"], "Analysis"); }