public async Task SendPackagePublishedEmailThrowsWhenPackageIsNull() { var service = new PackageMessageService(CoreMessageServiceMock.Object, EmailConfigurationAccessorMock.Object, LoggerMock.Object); var ex = await Assert.ThrowsAsync <ArgumentNullException>(() => service.SendPublishedMessageAsync(null)); Assert.Equal("package", ex.ParamName); }
public void SendPackagePublishedEmailMethodCallsCoreMessageService() { var service = new PackageMessageService(CoreMessageServiceMock.Object, EmailConfigurationAccessorMock.Object, LoggerMock.Object); var ex = Record.Exception(() => service.SendPublishedMessageAsync(Package).Wait()); Assert.Null(ex); CoreMessageServiceMock .Verify(cms => cms.SendMessageAsync(It.Is <PackageAddedMessage>(arg => arg.Package == Package), It.IsAny <bool>(), It.IsAny <bool>()), Times.Once()); CoreMessageServiceMock .Verify(cms => cms.SendMessageAsync(It.IsAny <PackageAddedMessage>(), It.IsAny <bool>(), It.IsAny <bool>()), Times.Once()); }