示例#1
0
        public void Integrated_add_appointment_to_patient()
        {
            // Arrange
            DateTime appointmentDate = DateTime.Now;
            string   interview       = "The patient is as fit as it can be!";
            var      appointment     = new Appointment
            {
                Date      = appointmentDate,
                Interview = interview
            };

            string firstName = "Foo";
            string lastName  = "Fighters";

            DatabaseTools.AddPatientToDatabase(firstName, lastName, appointmentDate);
            PatientEntity patientEntity = DatabaseTools.GetPatientFromDatabase(firstName, lastName).First();

            Assert.AreEqual(patientEntity.Appointments.Count, 1);

            // Act
            _patientService.AddAppointmentToPatient(patientEntity.Id, appointment);

            // Assert
            PatientEntity updatedPatientEntity = DatabaseTools.GetPatientFromDatabase(firstName, lastName).First();

            Assert.AreEqual(updatedPatientEntity.Appointments.Count, 2);
            Assert.AreEqual(updatedPatientEntity.Appointments.First().Date.Date, appointmentDate.Date);
            Assert.AreEqual(updatedPatientEntity.Appointments.Last().Date.Date, appointmentDate.Date);
            StringAssert.Contains(updatedPatientEntity.Appointments.First().Interview, interview);
        }