コード例 #1
0
        public void slettBillett_OK()
        {
            //Arrange
            var SessionMock = new TestControllerBuilder();
            var controller  = new ClearSkiesController(new AirlineLogikk(new AirlineDALStub()));

            SessionMock.InitializeController(controller);
            controller.Session["LoggetInn"] = true;

            //Act
            var result = controller.slettBillett(1);

            //Asssert
            result.AssertActionRedirect().ToAction("endreBestilling");
        }
コード例 #2
0
        public void slettBillett_IKKE_OK()
        {
            //Arrange
            var SessionMock = new TestControllerBuilder();
            var controller  = new ClearSkiesController(new AirlineLogikk(new AirlineDALStub()));

            SessionMock.InitializeController(controller);
            controller.Session["LoggetInn"] = true;

            //Act
            var result = (RedirectToRouteResult)controller.slettBillett(2);

            //Assert
            result.AssertActionRedirect().ToAction("endreBestilling");
            Assert.AreEqual(true, controller.Session["FeilBillett"]);
        }