Пример #1
0
 public AdminControllerTest()
 {
     _session = new TestControllerBuilder();
     _ctrl = new AdminController(new AdminBLL(new AdminDALStub(), new KundeDALStub()), new KundeBLL(new KundeDALStub()), new ProduktBLL(new ProduktDALStub()));
     // initierer sessionvariablen for innlogging for alle metoder
     // feilaktig innlogging blir testet ved testing av innloggingsmetoden
     _session.InitializeController(_ctrl);
     _ctrl.Session["Admin"] = (bool)true;
 }
Пример #2
0
 public void VisIndex()
 {
     var SessionMock = new TestControllerBuilder();
     var ctrl = new AdminController(new AdminBLL(new AdminDALStub(), new KundeDALStub()), new KundeBLL(new KundeDALStub()), new ProduktBLL(new ProduktDALStub()));
     SessionMock.InitializeController(ctrl);
     ctrl.Session["Admin"] = (bool)true;
     // Act
     var actionResult = (ViewResult)ctrl.Index();
     // Assert
     Assert.AreEqual(actionResult.ViewName, "");
 }