public void ShouldCreateInstanceOfConfiguredEmailProvider(string providerType, Type providerTypeType) { var factory = new DefaultEmailProviderFactory(providerType); var provider = factory.GetEmailProvider(); provider.Should().BeOfType(providerTypeType); }
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); }
public void ShouldNotCreateInstanceOfConfiguredEmailProviderWithTypeNotEmailProvider(string providerType) { var factory = new DefaultEmailProviderFactory(providerType); Assert.Throws <InvalidCastException>(() => factory.GetEmailProvider()); }
public void ShouldConfigureNullLoggingProviderIfNotSpecified() { var factory = new DefaultEmailProviderFactory(typeof(StubEmailProvider).FullName); factory.EmailLoggingProvider.Should().BeOfType <NullEmailLoggingProvider>(); }