public void AdminSide_IkkeLoggin() { var SessionMock = new TestControllerBuilder(); var controller = new LoginnController(); SessionMock.InitializeController(controller); controller.Session["LoggetInn"] = null; var result = (RedirectToRouteResult)controller.AdminSide(); Assert.AreEqual(result.RouteName, ""); Assert.AreEqual(result.RouteValues.Values.First(), "Index"); }
public void AdminSide_Loggin() { var SessionMock = new TestControllerBuilder(); var controller = new LoginnController(); SessionMock.InitializeController(controller); controller.Session["LoggetInn"] = true; controller.ViewData.ModelState.AddModelError("adminside", "admin side er åpen"); var actionResult = (ViewResult)controller.AdminSide(); Assert.IsTrue(actionResult.ViewData.ModelState.Count == 1); Assert.AreEqual(actionResult.ViewName, ""); }