public async Task AddNotification_ReturnsOkObjectResult() { var result = await _controller.Add(It.IsAny <MessageDto>()); _notificationsServiceMock.Verify(obj => obj.AddAsync(It.IsAny <MessageDto>())); result .Should() .BeOfType <OkResult>(); }
public async Task Add_ShouldCallNotificationsRepositoryAdd() { var called = false; var userChannel = "http://www.mycompany.com/testChannel"; var userNotificationType = NotificationType.WindowsPhoneNotification; var notificationChannelRepository = new Data.Repositories.Fakes.StubINotificationChannelRepository(); notificationChannelRepository.AddUserChannelAsyncStringStringNotificationType = (userIdentity, channel, notificationType) => { Assert.AreEqual(userChannel, channel); Assert.AreEqual(userNotificationType, notificationType); called = true; return(Task.FromResult(string.Empty)); }; var notificationsController = new NotificationsController(notificationChannelRepository, new SecurityHelper()); await notificationsController.Add(new Models.ClientNotificationChannel { ChannelUri = userChannel, NotificationType = userNotificationType }); Assert.IsTrue(called); }