public void StudentDeleteIspitComfirmed() { StudentController sk = new StudentController(); Mock <UnitOfWork> mockUnit = new Mock <UnitOfWork>(new Zadatak2Context()); Mock <IspitRepository> mockIspit = new Mock <IspitRepository>(new Zadatak2Context()); mockIspit.Setup(x => x.FindIspit(1, 1)).Returns(new Ispit { BI = 1, PredmetId = 1, Oena = 7 }); mockIspit.Setup(x => x.Delete(new Ispit { BI = 1, PredmetId = 1, Oena = 7 })); mockUnit.Setup(x => x.SaveChanges()); sk.UnitOfWork = mockUnit.Object; sk.UnitOfWork.Ispiti = mockIspit.Object; ViewResult rezultat = sk.DeleteIspitConfirmed(1, 1) as ViewResult; mockIspit.Verify((x => x.FindIspit(1, 1)), Times.Once()); mockIspit.Verify((x => x.Delete(It.IsAny <Ispit>())), Times.Once()); mockUnit.Verify((x => x.SaveChanges()), Times.Once()); }