コード例 #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);
            }
        }