Exemplo n.º 1
0
        public void Step2_Submit_Returns_View()
        {
            // Arrange
            AnalysisController analysis = GetAnalysisController();

            Step2Model model = new Step2Model
            {
                StudyName        = "Name",
                StudyDescription = "Desc"
            };

            // Act
            RedirectToRouteResult action = (RedirectToRouteResult)analysis.Step2("Submit", model, analysis.ControllerContext.HttpContext.User, 1);

            // Assert
            Assert.IsInstanceOf(typeof(ActionResult), action);
            Assert.AreEqual(action.RouteValues["action"], "Step2b");
            Assert.AreEqual(action.RouteValues["controller"], "Analysis");

            action = (RedirectToRouteResult)analysis.Step2("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.Step2("Back", model, analysis.ControllerContext.HttpContext.User, 2);

            // Assert
            Assert.IsInstanceOf(typeof(ActionResult), action);
            Assert.AreEqual(action.RouteValues["action"], "Step1b");
            Assert.AreEqual(action.RouteValues["controller"], "Analysis");
        }
Exemplo n.º 2
0
        public void Step2_Get_Returns_View()
        {
            // Arrange
            AnalysisController analysis = GetAnalysisController();

            // Act
            ActionResult view = analysis.Step2(analysis.ControllerContext.HttpContext.User, 1);

            // Assert
            Assert.IsInstanceOf(typeof(ViewResult), view);
        }