Exemple #1
0
        public async Task SendPackageValidationFailedMessageCallsCoreMessageService()
        {
            var service = new PackageMessageService(CoreMessageServiceMock.Object, EmailConfigurationAccessorMock.Object, LoggerMock.Object);

            var ex = await Record.ExceptionAsync(() => service.SendValidationFailedMessageAsync(Package, ValidationSet));

            Assert.Null(ex);

            CoreMessageServiceMock
            .Verify(cms => cms.SendMessageAsync(It.IsAny <PackageValidationFailedMessage>(), It.IsAny <bool>(), It.IsAny <bool>()), Times.Once());
        }
Exemple #2
0
        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());
        }
Exemple #3
0
        public void SendPackageValidationFailedMessageCallsCoreMessageService()
        {
            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.SendValidationFailedMessageAsync(SymbolPackage, ValidationSet).Wait());

            Assert.Null(ex);

            CoreMessageServiceMock
            .Verify(cms => cms.SendMessageAsync(It.IsAny <SymbolPackageValidationFailedMessage>(), It.IsAny <bool>(), It.IsAny <bool>()), Times.Once());
        }
        public void SendPackageValidationFailedMessageCallsCoreMessageService()
        {
            var expectedPackageUrl = string.Format(EmailConfiguration.PackageUrlTemplate, Package.PackageRegistration.Id, Package.NormalizedVersion);
            var expectedSupportUrl = string.Format(EmailConfiguration.PackageSupportTemplate, Package.PackageRegistration.Id, Package.NormalizedVersion);

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

            var ex = Record.Exception(() => service.SendPackageValidationFailedMessage(Package));

            Assert.Null(ex);

            CoreMessageServiceMock
            .Verify(cms => cms.SendPackageValidationFailedNotice(Package, expectedPackageUrl, expectedSupportUrl), Times.Once());
            CoreMessageServiceMock
            .Verify(cms => cms.SendPackageValidationFailedNotice(It.IsAny <Package>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once());
        }