예제 #1
0
        public async void CancelAppointment_WhenCalledWithValidAppointment_ReturnsOk()
        {
            // Arrange
            var apptItem = new AppointmentEntity()
            {
                PatientID           = 200,
                AppointmentDateTime = DateTime.Now.AddDays(1)
            };
            var apptDtoItem = FakeBookings.GetFakeAppointmentDto();
            var mapper      = TestHelpers.Helpers.GetAppointmentMapperForTest();

            _repo.CancelBookingAsync(apptItem).ReturnsForAnyArgs(true);

            var mycontroller       = new AppointmentsController(_repo, _notify, mapper, _logger);
            var expectedCodeResult = new StatusCodeResult(200);

            // Act
            var sut = await mycontroller.CancelAppointment(apptDtoItem);

            var result = sut as OkResult;

            // Assert
            Assert.NotNull(result);
            Assert.Equal(expectedCodeResult.StatusCode, result.StatusCode);
        }