public async Task GenerateNotificationsAsync_With1EventFor1UsersWhereEventIsOutsideOfTravelPreference_SendsNoEmail() { // Arrange List <Event> events = GetEventList1(); List <User> users = GetUserList1(); events[0].EventDate = DateTimeOffset.UtcNow.AddDays(3); EventRepository.Setup(e => e.GetActiveEvents(It.IsAny <CancellationToken>())).ReturnsAsync(events); UserRepository.Setup(u => u.GetAllUsers(It.IsAny <CancellationToken>())).ReturnsAsync(users); // Setup a return of distance between User and Event of 50 (in whatever units) MapRepository.Setup(mr => mr.GetDistanceBetweenTwoPoints(It.IsAny <Tuple <double, double> >(), It.IsAny <Tuple <double, double> >(), It.IsAny <bool>())).ReturnsAsync(50); // Act await Engine.GenerateNotificationsAsync().ConfigureAwait(false); // Assert UserRepository.Verify(_ => _.GetAllUsers(It.IsAny <CancellationToken>()), Times.Once); EventRepository.Verify(_ => _.GetActiveEvents(It.IsAny <CancellationToken>()), Times.Once); UserNotificationPreferenceRepository.Verify(_ => _.GetUserNotificationPreferences(It.IsAny <Guid>(), It.IsAny <CancellationToken>()), Times.Once); EventAttendeeRepository.Verify(_ => _.GetEventsUserIsAttending(It.IsAny <Guid>(), It.IsAny <bool>(), It.IsAny <CancellationToken>()), Times.Once); UserNotificationRepository.Verify(_ => _.AddUserNotification(It.IsAny <UserNotification>()), Times.Never); EmailSender.Verify(_ => _.SendEmailAsync(It.IsAny <Email>(), It.IsAny <CancellationToken>()), Times.Never); }