Beispiel #1
0
        public async Task SendPackageValidationFailedMessageThrowsWhenValidationSetIsNull()
        {
            var service = new PackageMessageService(CoreMessageServiceMock.Object, EmailConfigurationAccessorMock.Object, LoggerMock.Object);
            var ex      = await Assert.ThrowsAsync <ArgumentNullException>(() => service.SendValidationFailedMessageAsync(new Package(), null));

            Assert.Equal("validationSet", ex.ParamName);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
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());
        }
Beispiel #4
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());
        }