Пример #1
0
        public void BookAppointment_AvailabilityNotFound_ReturnServiceFailuare()
        {
            var expectedResult            = new ServiceResult(false, "User Availability not Found");
            UserAvailability availability = null;
            int availabilityId            = 1;

            _mockUserAvailabilityRepository.Setup(m => m.GetById(availabilityId)).Returns(availability);

            var result = _service.BookAppointment("test", DateTime.Now, TimeSpan.Zero, "", 0, availabilityId);

            result.Should().NotBeNull();
            result.Succeeded.Should().Be(expectedResult.Succeeded);
            result.ErrorMessage.Should().Be(expectedResult.ErrorMessage);
        }
Пример #2
0
        public async Task BookAppointment_ShouldBeSuccessful_ForExistingContact()
        {
            var dummyContact = new Contact
            {
                ID = 10
            };

            var dummyBookingRecord = new BookingRecord
            {
                contact = dummyContact
            };

            _appointmentRepoMock.Setup(x => x.VerifyTimeSlotAvailable(dummyBookingRecord)).ReturnsAsync(true);
            _contactRepoMock.Setup(x => x.CheckDuplicate(dummyBookingRecord.contact))
            .ReturnsAsync(dummyContact);
            _appointmentRepoMock.Setup(x => x.AddAppointment(dummyBookingRecord, dummyContact.ID)).ReturnsAsync(true);

            var response = await _appointmentService.BookAppointment(dummyBookingRecord);

            Assert.True(response);
        }