예제 #1
0
        public void Set_appointment_done()
        {
            using (var context = new MyDbContext(_options))
            {
                SetupDatabase(context);
                HospitalApp.Services.ReferralService    referralService = new HospitalApp.Services.ReferralService(context);
                HospitalApp.Services.AppointmentService service         = new HospitalApp.Services.AppointmentService(context, referralService);

                AppointmentDto appointment = service.SetAppointmentDone(1);

                appointment.Status.ShouldBe(AppointmentStatus.Done);
            }
        }
예제 #2
0
        public void Get_by_id()
        {
            using (var context = new MyDbContext(_options))
            {
                SetupDatabase(context);
                HospitalApp.Services.ReferralService    referralService = new HospitalApp.Services.ReferralService(context);
                HospitalApp.Services.AppointmentService service         = new HospitalApp.Services.AppointmentService(context, referralService);

                AppointmentDto appointment = service.GetById(1);

                appointment.Id.ShouldBe(1);
            }
        }
예제 #3
0
        public void Get_all_appointments()
        {
            using (var context = new MyDbContext(_options))
            {
                SetupDatabase(context);
                HospitalApp.Services.ReferralService    referralService = new HospitalApp.Services.ReferralService(context);
                HospitalApp.Services.AppointmentService service         = new HospitalApp.Services.AppointmentService(context, referralService);

                List <AppointmentDto> appointments = service.GetAll();

                appointments.Count.ShouldBeGreaterThanOrEqualTo(2);
            }
        }
예제 #4
0
        public void Get_appointment_full_date_string()
        {
            using (var context = new MyDbContext(_options))
            {
                SetupDatabase(context);
                HospitalApp.Services.ReferralService    referralService = new HospitalApp.Services.ReferralService(context);
                HospitalApp.Services.AppointmentService service         = new HospitalApp.Services.AppointmentService(context, referralService);
                Appointment app = CreateOne(context);

                DateTime dateAndTime = service.GetAppointmentFullDate(app);

                dateAndTime.ShouldBe(DateTime.Parse("2020-05-05 02 PM"));
            }
        }
예제 #5
0
        public void Finish_appointment()
        {
            using (var context = new MyDbContext(_options))
            {
                SetupDatabase(context);
                HospitalApp.Services.ReferralService    referralService = new HospitalApp.Services.ReferralService(context);
                HospitalApp.Services.AppointmentService service         = new HospitalApp.Services.AppointmentService(context, referralService);
                Appointment app = CreateOne(context);

                AppointmentDto appDto = service.FinishAppointment(app.Id);

                appDto.Status.ShouldBe(AppointmentStatus.Done);
            }
        }
예제 #6
0
        public void Set_appointments_referral_deleted()
        {
            using (var context = new MyDbContext(_options))
            {
                SetupDatabase(context);
                HospitalApp.Services.ReferralService    referralService = new HospitalApp.Services.ReferralService(context);
                HospitalApp.Services.AppointmentService service         = new HospitalApp.Services.AppointmentService(context, referralService);
                Appointment app = CreateOne(context);

                service.SetAppointmentsReferralDeleted(app);

                app.Patient.Referral.IsDeleted.ShouldBe(true);
            }
        }
예제 #7
0
        public void Get_patient_appointments()
        {
            using (var context = new MyDbContext(_options))
            {
                SetupDatabase(context);
                HospitalApp.Services.ReferralService    referralService = new HospitalApp.Services.ReferralService(context);
                HospitalApp.Services.AppointmentService service         = new HospitalApp.Services.AppointmentService(context, referralService);
                Patient p = CreatePatient(context);

                List <AppointmentDto> apps = service.GetPatientAppointments(p.Id);

                p.Appointments.Count.ShouldBe(apps.Count);
            }
        }
예제 #8
0
        public void Get_doctor_appointments()
        {
            using (var context = new MyDbContext(_options))
            {
                SetupDatabase(context);
                HospitalApp.Services.ReferralService    referralService = new HospitalApp.Services.ReferralService(context);
                HospitalApp.Services.AppointmentService service         = new HospitalApp.Services.AppointmentService(context, referralService);
                Doctor d = CreateDoctor(context);


                List <AppointmentDto> apps = service.GetDoctorAppointments(d.Id);

                apps.Count.ShouldBe(2);
            }
        }