예제 #1
0
        public void BookingUpdateTests_Succeed_When_Availability_Exist()
        {
            // mocking a new patient
            var patient = new Patient
            {
                FullName = "Brook Shield",
                Email    = "*****@*****.**"
            };

            var patientID = _patientRepository.AddPatient(patient);

            // mocking up a new booking for cancellation
            var booking = new Booking
            {
                PatientID     = patientID,
                StartDate     = DateTime.Parse("28 Dec 2020 10:15"),
                EquipmentID   = 0,
                bookingStatus = BookingStatus.Live
            };

            _bookingService = new BookingService(_bookingRepositoryService, _patientRepository, _equipmentApi, _emailSetting);

            var response = _bookingService.CreateBooking(booking.PatientID, booking.StartDate);

            // preparing updating
            // setting a new appt date request
            var newAppointmentDate = DateTime.Parse("29 Dec 2020 08:00");

            response = _bookingService.UpdateBooking(patientID, booking.StartDate, newAppointmentDate);

            // displaying response message
            _output.WriteLine(response.Result.Message);

            // displaying errors if any
            if (response.Result.Errors != null)
            {
                foreach (var err in response.Result.Errors)
                {
                    _output.WriteLine(err.Message);
                }
            }

            Assert.True(true);
        }
예제 #2
0
        public void BookingCancellationTests_Cancel_When_BookingExist()
        {
            // mocking a new the patient
            var patient = new Patient
            {
                FullName = "Brook Shield",
                Email    = "*****@*****.**"
            };

            var patientID = _patientRepository.AddPatient(patient);

            // mocking up a new booking for cancellation
            var booking = new Booking
            {
                PatientID     = patientID,
                StartDate     = DateTime.Parse("28 Dec 2020 10:15"),
                EquipmentID   = 1,
                bookingStatus = BookingStatus.Live
            };

            _bookingService = new BookingService(_bookingRepositoryService, _patientRepository, _equipmentApi, _emailSetting);

            var response = _bookingService.CreateBooking(booking.PatientID, booking.StartDate);

            // preparing cancellation

            response = _bookingService.CancelBooking(patientID, booking.StartDate);

            // displaying response message
            _output.WriteLine(response.Result.Message);

            // displaying errors if any
            if (response.Result.Errors != null)
            {
                foreach (var err in response.Result.Errors)
                {
                    _output.WriteLine(err.Message);
                }
            }

            Assert.True(true);
        }
예제 #3
0
        public void BookingCreateTest_WhenEquipment_Available()
        {
            var booking = new Booking
            {
                PatientID     = 1,
                StartDate     = DateTime.Parse("28 Dec 2020 11:15"),
                EquipmentID   = 0,
                bookingStatus = BookingStatus.Request,
            };

            // mocking a new the patient for email address notification later
            var patient = new Patient
            {
                FullName = "Brook Shield",
                Email    = "*****@*****.**"
            };

            var patientID = _patientRepository.AddPatient(patient);

            _bookingService = new BookingService(_bookingRepositoryService, _patientRepository, _equipmentApi, _emailSetting);

            var response = _bookingService.CreateBooking(booking.PatientID, booking.StartDate);

            // displaying response message
            _output.WriteLine(response.Result.Message);

            // displaying errors if any
            if (response.Result.Errors != null)
            {
                foreach (var err in response.Result.Errors)
                {
                    _output.WriteLine(err.Message);
                }
            }

            Assert.True(true);
        }
예제 #4
0
        public void BookingSelectTests_GetAll_Bookings_for_Today()
        {
            // mocking a new patient
            var patient = new Patient
            {
                FullName = "Brook Shield",
                Email    = "*****@*****.**"
            };

            var patientID = _patientRepository.AddPatient(patient);

            // mocking up a new booking
            var booking = new Booking
            {
                PatientID     = patientID,
                StartDate     = DateTime.Parse("28 Dec 2020 10:15"),
                EquipmentID   = 0,
                bookingStatus = BookingStatus.Live
            };

            _bookingService = new BookingService(_bookingRepositoryService, _patientRepository, _equipmentApi, _emailSetting);

            var response = _bookingService.CreateBooking(booking.PatientID, booking.StartDate);

            // tweaking appointment date to make a valid case for today selection
            var newAppointmentDate = DateTime.Now.Date;

            var bookings = _bookingService.GetTodayBooking();

            // displaying booking
            if (bookings != null)
            {
                foreach (var bk in bookings.Result)
                {
                    _output.WriteLine($"{bk.BookingID}: {bk.bookingStatus}:{bk.EquipmentID}: {bk.PatientID} {bk.StartDate}: {bk.EndDate} ");
                }
            }

            Assert.True(true);
        }