public void Scheduling_Appointment_HappyPath() { //Arrange Setup(); var providerDomain = new ProviderDomain(new ProvidersRepository()); var patientDomain = new PatientDomain(new PatientsRepository()); var serviceDomain = new ServiceDomain(new ServicesRepository()); var appointmentDomain = new AppointmentsDomain(new AppointmentsRepository()); var savedProvider = providerDomain.GetProvider(1); var savedPatient = patientDomain.GetPatient(1); var savedService = serviceDomain.GetService(1); var appointment = new Appointment { Patient = savedPatient, Provider = savedProvider, Service = savedService, ReasonForVisit = "There's no place like home", RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000"), }; //Act var savedAppointment = appointmentDomain.SetAppointment(appointment); //Assert Assert.IsTrue(savedAppointment.Id != 0); }
public void Scheduling_Appointment_For_Underage_Patients_Should_Fail() { //Arrange Setup(); var providerDomain = new ProviderDomain(new ProvidersRepository()); var patientDomain = new PatientDomain(new PatientsRepository()); var serviceDomain = new ServiceDomain(new ServicesRepository()); var appointmentDomain = new AppointmentsDomain(new AppointmentsRepository()); var savedProvider = providerDomain.GetProvider(1); var savedService = serviceDomain.GetService(1); var underagePatient = new Patient { Age = 15, Name = "Lion" }; underagePatient = patientDomain.CreatePatient(underagePatient); var appointment = new Appointment { Patient = underagePatient, Provider = savedProvider, Service = savedService, ReasonForVisit = "There's no place like home", RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000"), }; //Act var savedAppointment = appointmentDomain.SetAppointment(appointment); }
public void Scheduling_Appointment_After_Clinic_Hours_Should_Fail() { //Arrange Setup(); var providerDomain = new ProviderDomain(new ProvidersRepository()); var patientDomain = new PatientDomain(new PatientsRepository()); var serviceDomain = new ServiceDomain(new ServicesRepository()); var appointmentDomain = new AppointmentsDomain(new AppointmentsRepository()); var savedProvider = providerDomain.GetProvider(1); var savedPatient = patientDomain.GetPatient(1); var savedService = serviceDomain.GetService(1); var appointment = new Appointment { Patient = savedPatient, Provider = savedProvider, Service = savedService, ReasonForVisit = "There's no place like home", RequestedAppointmentDate = DateTime.Parse("2000/01/01 16:00:01.000"), }; //Act var savedAppointment = appointmentDomain.SetAppointment(appointment); }
public void Scheduling_Appointment_For_Provider_More_Than_Five_Minutes_After_Previous_Booking_But_Not_Overlapping_Next_Booking_Should_Pass() { //Arrange Setup(); var providerDomain = new ProviderDomain(new ProvidersRepository()); var patientDomain = new PatientDomain(new PatientsRepository()); var serviceDomain = new ServiceDomain(new ServicesRepository()); var appointmentDomain = new AppointmentsDomain(new AppointmentsRepository()); var savedProvider = providerDomain.GetProvider(1); var savedService = serviceDomain.GetService(1); var savedPatient = patientDomain.GetPatient(1); var savedShortService = serviceDomain.GetService(2); var appointment = new Appointment { Patient = savedPatient, Provider = savedProvider, Service = savedService, ReasonForVisit = "There's no place like home", RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000"), }; //Act var savedAppointment = appointmentDomain.SetAppointment(appointment); var nextAppointment = new Appointment { Patient = savedPatient, Provider = savedProvider, Service = savedService, RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000").AddHours(savedAppointment.PlannedDuration.Hours + 1), ReasonForVisit = "A New Brain" }; var savedNextAppointment = appointmentDomain.SetAppointment(nextAppointment); var inBetweenAppointment = new Appointment { Patient = savedPatient, Provider = savedProvider, Service = savedShortService, RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000").AddHours(savedAppointment.PlannedDuration.Hours).AddMinutes(6), ReasonForVisit = "I just want to go home" }; var savedInBetweenAppointment = appointmentDomain.SetAppointment(inBetweenAppointment); Assert.IsTrue(savedInBetweenAppointment.Id != 0); }
public void Scheduling_Appointment_For_Provider_Less_Than_Five_Minutes_After_Previous_Booking_Should_Fail() { //Arrange Setup(); var providerDomain = new ProviderDomain(new ProvidersRepository()); var patientDomain = new PatientDomain(new PatientsRepository()); var serviceDomain = new ServiceDomain(new ServicesRepository()); var appointmentDomain = new AppointmentsDomain(new AppointmentsRepository()); var savedProvider = providerDomain.GetProvider(1); var savedService = serviceDomain.GetService(1); var savedPatient = patientDomain.GetPatient(1); var appointment = new Appointment { Patient = savedPatient, Provider = savedProvider, Service = savedService, ReasonForVisit = "There's no place like home", RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000"), }; //Act var savedAppointment = appointmentDomain.SetAppointment(appointment); var overlappingAppointment = new Appointment { Patient = savedPatient, Provider = savedProvider, Service = savedService, RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000").AddHours(savedAppointment.PlannedDuration.Hours).AddMinutes(5), ReasonForVisit = "A New Brain" }; var savedOverlappingAppointment = appointmentDomain.SetAppointment(overlappingAppointment); }