public void Send_invoice() { var invoice = CreateInvoice(); mailer.InvoiceToEmail(invoice, false); mailer.Send(); Assert.That(message.Body, Is.StringContaining("Примите счет за информационное обслуживание в ИС АналитФармация.")); }
protected override void Process() { var invoices = Session.Query <Invoice>() .Where(i => ((i.SendToEmail && i.Payer.InvoiceSettings.EmailInvoice) || (i.SendToMinimail && i.Payer.InvoiceSettings.SendToMinimail)) && i.Date <= DateTime.Today); foreach (var invoice in invoices) { _mailer.Clear(); if (invoice.SendToEmail && invoice.Payer.InvoiceSettings.EmailInvoice) { _mailer.InvoiceToEmail(invoice, false); } else if (invoice.SendToMinimail && invoice.Payer.InvoiceSettings.SendToMinimail) { _mailer.SendInvoiceToMinimail(invoice); invoice.SendToMinimail = false; } _mailer.Send(); Session.Save(invoice); } }