public async Task DeletePatient_SuccessResult() { PatientLogic patientData = new PatientLogic(this.patRepo.Object); // Create model PatientViewModel model = new PatientViewModel() { PatientId = 1, FirstName = "Andrew", LastName = "Moshko", MiddleName = "Victor", Age = "18", Weight = "83", Height = "195", Email = "*****@*****.**", PhoneNumber = "+380995135682", HomeNumber = "-", Sex = "man", Condition = "test Patient" }; // Create object Doctor Patient patient = model.ToEntity(); this.ultraRepository.Setup(x => x.AddPatientAsync(patient)) .ReturnsAsync(patient).Verifiable(); this.ultraRepository.Setup(x => x.DeletePatientAsync(patient.PatientId)) .ReturnsAsync(true).Verifiable(); // Run Code var result = await patientData.DeletePatientAsync(model.PatientId); // AddAsync(mockModel.Object); Assert.True(result); }
public async Task DeletePatient_ExceptionResult() { PatientLogic doctorLogic = new PatientLogic(this.patRepo.Object); int?id = null; await Assert.ThrowsAsync <Exception>(async() => { var result = await doctorLogic.DeletePatientAsync((int)id); }); }