public HistoryMailFixture() { var loggerFactory = new LoggerFactory(new[] { new DebugLoggerProvider() }, new LoggerFilterOptions() { MinLevel = LogLevel.Debug }); // ReSharper disable once UnusedVariable var mkSettings = SetupMailerOptions(out bool isMailServerAlive).Value; SmtpClient GetClientFunc() { var c = Substitute.For <SmtpClient>(); c.SendAsync(Arg.Any <MimeMessage>(), Arg.Any <CancellationToken>()) .Returns(Task.CompletedTask); return(c); } var logger = loggerFactory.CreateLogger <MkSmtpMailer>(); MailerFactoryForHistoryWithSerializableAttachments.AddMkSmtpMailer(GetClientFunc, mkSettings, logger, StoreWithSerializableAttachments); MailerFactoryForHistoryWithoutSerializableAttachments.AddMkSmtpMailer(GetClientFunc, mkSettings, logger, StoreWithoutSerializableAttachments); }
public HistoryMailFixture() { var loggerFactory = new LoggerFactory(); loggerFactory.AddDebug(LogLevel.Debug); var sendGridSettings = new SendGridMailerSettings { ApiKey = "abc", FromDisplayName = "xunit", FromEmailAddress = "*****@*****.**" }; var logger = loggerFactory.CreateLogger <SendGridMailer>(); MailerFactoryForHistoryWithSerializableAttachments.Register(() => new SendGridMailerFake( new OptionsWrapper <SendGridMailerSettings>(sendGridSettings), logger, StoreWithSerializableAttachments)); MailerFactoryForHistoryWithoutSerializableAttachments.Register(() => new SendGridMailerFake( new OptionsWrapper <SendGridMailerSettings>(sendGridSettings), logger, StoreWithoutSerializableAttachments)); }