public void TestPasServiceGetAll() { var service = new PasService(unitOfWork.Object); var result = service.GetAll(); var listaPasa = Assert.IsAssignableFrom <IEnumerable <Pas> >(result); Assert.NotEmpty(listaPasa); }
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); }