public void UpdateDoctorTest()
        {
            var dataStorage = new OfflineDataStorage();

            var doctorToUpdate = dataStorage.GetDoctors().Last();

            doctorToUpdate.Name = "QWERTY";

            dataStorage.UpdateDoctor(doctorToUpdate);
            Assert.AreEqual("QWERTY", dataStorage.GetDoctors().Last().Name);
        }
        public void DeleteDoctorTest()
        {
            var dataStorage = new OfflineDataStorage();
            int count       = dataStorage.GetDoctors().Count();
            var docToDelete = dataStorage.GetDoctors().First();

            dataStorage.DeleteDoctor(docToDelete);

            var doctorsAfterDelete = dataStorage.GetDoctors();

            Assert.AreEqual(count - 1, doctorsAfterDelete.Count());
            CollectionAssert.DoesNotContain(doctorsAfterDelete.ToList(), docToDelete);
        }
        public void CreateDoctorTest()
        {
            var dataStorage = new OfflineDataStorage();
            int count       = dataStorage.GetDoctors().Count();
            var doctor      = new Doctor {
                Name = "ABC"
            };

            dataStorage.CreateDoctor(doctor);
            var doctorsAfterCreate = dataStorage.GetDoctors();

            Assert.AreEqual(count + 1, doctorsAfterCreate.Count());
            Assert.AreEqual(doctor, doctorsAfterCreate.FirstOrDefault(d => d.Id == doctor.Id));
        }
        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);
        }