public void TestPasServiceFindByIdInvalid() { var service = new PasService(unitOfWork.Object); var result = service.FindById(222); Assert.Null(result); }
public void TestPasServiceFindById() { var service = new PasService(unitOfWork.Object); var result = service.FindById(2); var pasResult = Assert.IsType <Pas>(result); var expected = unitOfWork.Object.PasRepository.FindById(2); Assert.Equal(expected.Ime, pasResult.Ime); }
public void TestPasServiceInsertPas() { var newPas = new Pas { Id = 8, Ime = "Lena", BrojZdravstveneKnjizice = "000765", Pol = "Ženski", Rasa = "Nemački ovčar", Obuka = obukaRepo.Object.FindById(5), ObukaId = 5, DatumRodjenja = new DateTime(2018, 11, 09) }; var service = new PasService(unitOfWork.Object); service.Insert(newPas); var result = service.GetAll(); Pas pas = service.FindById(newPas.Id); Assert.Equal(newPas.Id, pas.Id); unitOfWork.Verify(x => x.PasRepository.Insert(It.Is <Pas>(p => p.Ime == "Lena")), Times.Once); unitOfWork.Verify(x => x.Save(), Times.Once); }