예제 #1
0
        public void BookingCancellationTests_When_Booking_NotExist()
        {
            // 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
            //invalidating existing booking by changing to different date
            booking.StartDate = DateTime.Parse("29 Dec 2020 10:15");

            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);
        }
예제 #2
0
 public Task <ClientResponse> CancelBooking([FromBody] int patientId, DateTime appointmentDate)
 {
     return(_booking.CancelBooking(patientId, appointmentDate));
 }