public void DeleteAppointmentTest() { var dataStorage = new OfflineDataStorage(); int appointmentCount = dataStorage.GetAppointments().Count(); var appToDelete = dataStorage.GetAppointments().ElementAt(0); dataStorage.DeleteAppointment(appToDelete); var appointmentsAfterDelete = dataStorage.GetAppointments(); Assert.AreEqual(appointmentCount - 1, appointmentsAfterDelete.Count()); CollectionAssert.DoesNotContain(appointmentsAfterDelete.ToList(), appToDelete); }
public void CreateAppointmentTest() { var dataStorage = new OfflineDataStorage(); var count = dataStorage.GetAppointments().Count(); var patient = dataStorage.GetPatients().First(); var doctor = dataStorage.GetDoctors().First(); var time = DateTime.Now.AddHours(1); var appointment = new Appointment { Patient = patient, Doctor = doctor, Start = time, End = time.AddMinutes(15) }; dataStorage.CreateAppointment(appointment); var appointmentsAfterCreate = dataStorage.GetAppointments().ToList(); Assert.AreEqual(count + 1, appointmentsAfterCreate.Count()); CollectionAssert.Contains(appointmentsAfterCreate, appointment); }
public void UpdateAppointmentTest() { var dataStorage = new OfflineDataStorage(); var doctor = new Doctor { Name = "A" }; var appToUpdate = dataStorage.GetAppointments().ElementAt(0); appToUpdate.Doctor = doctor; dataStorage.UpdateAppointment(appToUpdate); var appAfterUpdate = dataStorage.GetAppointment(appToUpdate.Id); Assert.AreEqual(appAfterUpdate.Doctor.Name, doctor.Name); }