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

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

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


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

            var result = sut as StatusCodeResult;

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