Ejemplo n.º 1
0
        public void SlettFlyplass_session_ikke_OK()
        {
            // Arrange
            var SessionMock = new TestControllerBuilder();
            var controller  = new FlyplassController(new FlyplassBLL(new FlyplassStub()));

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

            // Act
            var result = (RedirectToRouteResult)controller.SlettFlyplass("");

            // Assert
            Assert.AreEqual(result.RouteName, "");
            Assert.AreEqual(result.RouteValues.Values.First(), "IngenTilgang");
        }
Ejemplo n.º 2
0
        public void SlettFlyplass()
        {
            // Arrange
            var SessionMock = new TestControllerBuilder();
            var controller  = new FlyplassController(new FlyplassBLL(new FlyplassStub()));

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

            // Act
            var actionResult = (ViewResult)controller.SlettFlyplass("");
            var resultat     = (Flyplass)actionResult.Model;

            // Assert
            Assert.AreEqual(actionResult.ViewName, "");
        }
Ejemplo n.º 3
0
        public void Slett_ikke_funnet_Post()
        {
            // Arrange
            var SessionMock = new TestControllerBuilder();
            var controller  = new FlyplassController(new FlyplassBLL(new FlyplassStub()));

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

            var innFlyplass = new Flyplass()
            {
                FlyplassKode = "OSL",
                By           = "Oslo"
            };

            // Act
            var actionResult = (ViewResult)controller.SlettFlyplass("", innFlyplass);

            // Assert
            Assert.AreEqual(actionResult.ViewName, "~/Views/Error/Error.cshtml");
        }
Ejemplo n.º 4
0
        public void Slettet_funnet_Post_session_ikke_OK()
        {
            // Arrange
            var SessionMock = new TestControllerBuilder();
            var controller  = new FlyplassController(new FlyplassBLL(new FlyplassStub()));

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

            var innFlyplass = new Flyplass()
            {
                FlyplassKode = "OSL",
                By           = "Oslo",
            };

            // Act
            var actionResult = (RedirectToRouteResult)controller.SlettFlyplass("OSL", innFlyplass);

            // Assert
            Assert.AreEqual(actionResult.RouteName, "");
            Assert.AreEqual(actionResult.RouteValues.Values.First(), "IngenTilgang");
        }