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"); }
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, ""); }
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"); }
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"); }