Example #1
0
        public async Task SendPackagePublishedEmailThrowsWhenPackageIsNull()
        {
            var service = new SymbolsPackageMessageService(CoreMessageServiceMock.Object, EmailConfigurationAccessorMock.Object, LoggerMock.Object);
            var ex      = await Assert.ThrowsAsync <ArgumentNullException>(() => service.SendPublishedMessageAsync(null));

            Assert.Equal("symbolPackage", ex.ParamName);
        }
Example #2
0
        public void SendPackagePublishedEmailMethodCallsCoreMessageService()
        {
            var expectedPackageUrl = string.Format(EmailConfiguration.PackageUrlTemplate, SymbolPackage.Package.PackageRegistration.Id, SymbolPackage.Package.NormalizedVersion);
            var expectedSupportUrl = string.Format(EmailConfiguration.PackageSupportTemplate, SymbolPackage.Package.PackageRegistration.Id, SymbolPackage.Package.NormalizedVersion);

            var service = new SymbolsPackageMessageService(CoreMessageServiceMock.Object, EmailConfigurationAccessorMock.Object, LoggerMock.Object);

            var ex = Record.Exception(() => service.SendPublishedMessageAsync(SymbolPackage).Wait());

            Assert.Null(ex);

            CoreMessageServiceMock
            .Verify(cms => cms.SendMessageAsync(It.IsAny <SymbolPackageAddedMessage>(), It.IsAny <bool>(), It.IsAny <bool>()), Times.Once());
        }