public void GetImmunisationCount_Return_Success() { int patientId = 100; var immunisation = new ImmunisationDto(); var patient = new PatientDto(DateTime.Now) { Id = 100, Immunisations = new List <ImmunisationDto>() { new ImmunisationDto() } }; var service = GetService(); immunisationRepository.Setup(x => x.GetTotal(It.IsAny <int>(), It.IsAny <DateTime>())) .Returns(patient.Immunisations.Count); service.CreatePatient(patient); var count = service.GetImmunisationCount(patientId); immunisationRepository.Verify(x => x.GetTotal(It.IsAny <int>(), It.IsAny <DateTime>()), Times.Once); Assert.AreEqual(count, patient.Immunisations.Count); }
public void AddImmunisation_Return_Success() { int patientId = 100; var immunisation = new ImmunisationDto(); var service = GetService(); service.AddImmunisation(patientId, immunisation); immunisationRepository.Verify(x => x.Add(It.IsAny <int>(), It.IsAny <Immunisation>()), Times.Once); }
public void AddImmunisation(int patientId, ImmunisationDto immunisation) { immunisationRepository.Add(patientId, mapper.Map <Immunisation>(immunisation)); }