Beispiel #1
0
        public void Controller_Calendar_SetNoSchoolDay_Id_Is_Null_Should_Return_Error_Page()
        {
            // Arrange
            CalendarController controller = new CalendarController();

            var context = CreateMoqSetupForCookie();

            controller.ControllerContext = new ControllerContext(context, new RouteData(), controller);

            // Act
            var result = (RedirectToRouteResult)controller.SetNoSchoolDay(null);

            // Assert
            Assert.AreEqual("Error", result.RouteValues["action"], TestContext.TestName);
        }
Beispiel #2
0
        public void Controller_Calendar_SetNoSchoolDay_Should_Return_Update_Page()
        {
            // Arrange
            CalendarController controller = new CalendarController();

            string id = DataSourceBackend.Instance.SchoolCalendarBackend.GetDefault().Id;

            var context = CreateMoqSetupForCookie();

            controller.ControllerContext = new ControllerContext(context, new RouteData(), controller);

            // Act
            var result = (RedirectToRouteResult)controller.SetNoSchoolDay(id);

            // Assert
            Assert.AreEqual("Update", result.RouteValues["action"], TestContext.TestName);
            Assert.AreEqual("Calendar", result.RouteValues["controller"], TestContext.TestName);
        }