public void Given_PatientHistoryRepository_When_DeletingAPatientHistory_Then_ThePatientHistoryShouldBeProperlyRemoved() { var doctor = Doctor.Create("Daniel", "Oana", "*****@*****.**", "parola", "0746524459", "ads", "Cardiologie", "Sf. Spiridon", "Iasi", "Str. Vasile Lupu"); var patient = Patient.Create("Roland", "Iordache", "*****@*****.**", "asfdsdssd", "Iasi", new DateTime(1996, 02, 10), "0746524459", null); RunOnDatabase(async ctx => { //Arrange var repository = new PatientHistoryRepository(ctx); var patientHistory = PatientHistory.Create(patient, doctor, "Paracetamol", "Febra", "Odihna", new DateTime(1996, 02, 10)); await repository.AddAsync(patientHistory); //Act await repository.DeleteAsync(patientHistory); //Assert Assert.AreEqual(repository.GetAllAsync().Result.Count, 0); }); }
public void Given_PatientHistoryRepository_When_DeletingAPatientHistory_Then_ThePatientHistoryShouldBeProperlyRemoved() { var patient = Patient.Create("1234", "Roland", "Iordache", "*****@*****.**", "asfdsdssd", "Iasi", "Romania", new DateTime(1996, 02, 10), "0746524459", null); var doctor = Doctor.Create("1234", "Mircea", "Cartarescu", "*****@*****.**", "parola", "0746524459", "blasdadsadsada", "Cardiologie", "Sf. Spiridon", "Iasi", "Romania", "Str. Vasile Lupu", true); RunOnDatabase(async ctx => { //Arrange var repository = new PatientHistoryRepository(ctx); var patientHistory = PatientHistory.Create(patient.PatientId); await repository.AddAsync(patientHistory); //Act await repository.DeleteAsync(patientHistory.HistoryId); //Assert string[] includes = { }; Assert.AreEqual(repository.GetAllAsync(includes).Result.Count, 0); }); }