예제 #1
0
            public void ShouldCreateInstanceOfConfiguredEmailProvider(string providerType, Type providerTypeType)
            {
                var factory  = new DefaultEmailProviderFactory(providerType);
                var provider = factory.GetEmailProvider();

                provider.Should().BeOfType(providerTypeType);
            }
예제 #2
0
            public async Task ShouldConfigureSpecifiedEmailLoggingProviderOnEmailProvider()
            {
                var factory         = new DefaultEmailProviderFactory(typeof(StubEmailProvider).AssemblyQualifiedName);
                var loggingProvider = new StubEmailLoggingProvider();

                factory.EmailLoggingProvider = loggingProvider;

                var provider = factory.GetEmailProvider();

                var emailMessage = new EmailMessage("*****@*****.**", "*****@*****.**")
                {
                    Subject = "Test"
                };

                emailMessage.AddBody(EmailMessageBody.FromText("test"));
                await provider.SendAsync(emailMessage);

                loggingProvider.LogCallCount.Should().Be(1);
            }
예제 #3
0
            public void ShouldNotCreateInstanceOfConfiguredEmailProviderWithTypeNotEmailProvider(string providerType)
            {
                var factory = new DefaultEmailProviderFactory(providerType);

                Assert.Throws <InvalidCastException>(() => factory.GetEmailProvider());
            }
예제 #4
0
            public void ShouldConfigureNullLoggingProviderIfNotSpecified()
            {
                var factory = new DefaultEmailProviderFactory(typeof(StubEmailProvider).FullName);

                factory.EmailLoggingProvider.Should().BeOfType <NullEmailLoggingProvider>();
            }