Exemple #1
0
        public void StudentDeleteIspit()
        {
            StudentController ik = 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
            });

            ik.UnitOfWork        = mockUnit.Object;
            ik.UnitOfWork.Ispiti = mockIspit.Object;
            ViewResult rezultat = ik.DeleteIspit(1, 1) as ViewResult;

            mockIspit.Verify((x => x.FindIspit(1, 1)), Times.Once());
            Assert.AreEqual(typeof(Ispit), rezultat.Model.GetType());
            Assert.IsNotNull(rezultat);
        }