public async void WhenThereAreLessThanOneReservation_ThenAMessageIsSent()
{
var mockClient = new Mock<TwilioRestClient>(null, null);
mockClient
.Setup(c => c.SendMessage(
It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()));
var mockRepository = new Mock<IReservationsRepository>();
mockRepository
.Setup(r => r.FindPendingReservationsAsync())
.ReturnsAsync(new List<Reservation>());
var notifier = new Notifier(
mockClient.Object, mockRepository.Object);
const string hostPhoneNumber = "host-phone-number";
await notifier.SendNotificationAsync(new Reservation
{
VacationProperty = new VacationProperty(),
PhoneNumber = hostPhoneNumber
});
mockClient.Verify(c => c.SendMessage(
It.IsAny<string>(), hostPhoneNumber, It.IsAny<string>()), Times.Once);
}
}