Esempio n. 1
0
        public void endreBestilling_OK()
        {
            //Arrange
            var SessionMock = new TestControllerBuilder();
            var controller  = new ClearSkiesController(new AirlineLogikk(new AirlineDALStub()));

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

            var billetter = new Model.BestillingBilletter()
            {
                BillettId          = 1,
                Fra                = "Gatwick, UK",
                Til                = "Gardemoen, Norge",
                Avreise            = new DateTime(2017, 10, 18, 16, 10, 0, 0),
                PassasjerFornavn   = "Ole",
                PassasjerEtternavn = "Olesen"
            };

            //Act
            var resultat = (ViewResult)controller.endreBestilling(1);

            //Assert
            Assert.AreEqual(resultat.ViewName, "");
        }
Esempio n. 2
0
        public void endreBestilling_IKKE_LOGGET_INN()
        {
            //Arrange
            var SessionMock = new TestControllerBuilder();
            var controller  = new ClearSkiesController();

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

            //Act
            var actionResult = (RedirectToRouteResult)controller.endreBestilling(0);

            //Assert
            Assert.AreEqual("Login", actionResult.RouteValues.Values.First());
        }
Esempio n. 3
0
        public void endreBestilling_IKKE_OK()
        {
            //Arrange
            var SessionMock = new TestControllerBuilder();
            var controller  = new ClearSkiesController(new AirlineLogikk(new AirlineDALStub()));

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

            //Act
            var resultat = (ViewResult)controller.endreBestilling(1);

            //Assert
            Assert.AreEqual(resultat.ViewName, "");
            Assert.AreEqual(null, resultat.ViewBag.Feil);
        }