public void Setup() { payer = DataMother.CreatePayerForBillingDocumentTest(); var invoices = payer.BuildInvoices(new DateTime(2011, 12, 10), new Period(2011, Interval.December)) .Concat(payer.BuildInvoices(new DateTime(2012, 1, 10), new Period(2012, Interval.January))) .ToArray(); invoices.SelectMany(i => i.Parts).Each(p => p.Process()); Save(invoices); Flush(); }
private Invoice BuildInvoice(DateTime date) { var invoices = payer.BuildInvoices(date, date.ToPeriod()); Assert.That(invoices.Count(), Is.EqualTo(1)); var invoice = invoices.Single(); Assert.That(invoice.Sum, Is.EqualTo(800)); session.Save(invoice); return(invoice); }
public void Do_not_save() { var ad = new Advertising(payer, 1000); payer.Ads.Add(ad); session.Save(ad); Reopen(); payer = session.Load <Payer>(payer.Id); var invoices = payer.BuildInvoices(DateTime.Now, DateTime.Now.ToPeriod()); var invoice = invoices.First(); Close(); Assert.That(invoice.Id, Is.EqualTo(0)); }
public void Build_invoice_for_invoice_groups() { client.AddUser(new User(client)); payer.Users[0].Accounting.ReadyForAccounting = true; payer.Users[1].Accounting.ReadyForAccounting = true; payer.Users[1].Accounting.Payment = 600; payer.Users[1].Accounting.InvoiceGroup = 1; var invoices = payer.BuildInvoices(DateTime.Now, DateTime.Now.ToPeriod()).ToList(); Assert.That(invoices.Count, Is.EqualTo(2)); var invoice = invoices[0]; Assert.That(invoice.Parts.Count, Is.EqualTo(1)); Assert.That(invoice.Parts[0].Sum, Is.EqualTo(800)); invoice = invoices[1]; Assert.That(invoice.Parts.Count, Is.EqualTo(1)); Assert.That(invoice.Parts[0].Sum, Is.EqualTo(600)); }