Пример #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);
            }
        }