public async void SendEmail()
        {
            var recipients = new List <string> {
                "*****@*****.**"
            };
            var report = new SolarAndUtilityReport(new DateInterval(new LocalDate(2017, 07, 17), new LocalDate(2017, 08, 16)), 100, 0, 2000);

            var expectedMessage = new MimeMessage
            {
                Subject = "expected message"
            };

            A.CallTo(() => reportFormatter.FormatReport(A <SolarAndUtilityReport> ._)).Returns(expectedMessage);

            await emailSender.SendEmail(report, recipients);

            CancellationToken cancellationToken = default;

            A.CallTo(() => smtpClient.ConnectAsync("aldaviva.com", 25, SecureSocketOptions.StartTls, cancellationToken))
            .MustHaveHappened()
            .Then(A.CallTo(() => smtpClient.AuthenticateAsync("user", "pass", cancellationToken)).MustHaveHappened())
            .Then(A.CallTo(() => smtpClient.SendAsync(A <MimeMessage> .That.Matches(message =>
                                                                                    message.Subject == "expected message"), cancellationToken, default)).MustHaveHappened())
            .Then(A.CallTo(() => smtpClient.DisconnectAsync(true, cancellationToken)).MustHaveHappened());
        }
Пример #2
0
        public void Print()
        {
            //_dataAccess = new DataAccess();
            _dataAccess.GetData();

            //_reportFormatter = new TabloidReportFormatter();
            _reportFormatter.FormatReport();

            //_reportPrinter = new TabloidReportPrinter();
            _reportPrinter.Print();
        }
Пример #3
0
 public static string FormatReport <TTask>(this TasksDurations <TTask> tasksDurations, bool includeHeader = true, Func <TTask, string> taskNameFormatter = null, Func <TimeSpan, string> taskDurationFormatter = null)
 {
     return(ReportFormatter.FormatReport(tasksDurations, includeHeader, taskNameFormatter, taskDurationFormatter));
 }