public void InvoiceAddLineItemEventAddsLineItem() { _mockInvoiceView.GetCustomer += null; LastCall.IgnoreArguments(); _mockInvoiceView.AddInvoiceLine += null; var addInvoiceLineEventRaiser = LastCall.IgnoreArguments().GetEventRaiser(); _mockInvoiceView.CalculateTotals += null; LastCall.IgnoreArguments(); _mockInvoiceView.SaveInvoice += null; LastCall.IgnoreArguments(); const int quantity = 3; const decimal amount = 35.00M; ITaxesService taxesService = new TaxesService(); Expect.Call(_mockInvoiceView.Quantity).Return(quantity); Expect.Call(_mockInvoiceView.Amount).Return(amount); Expect.Call(_mockTaxesRepository.GetTaxesService()).Return(taxesService); var invoiceItem = new InvoiceItem(quantity, amount); var invoice = new Invoice(taxesService); invoice.AddLineItem(invoiceItem); _mockInvoiceView.InvoiceLineItems = invoice.InvoiceItems; _mockRepository.ReplayAll(); var invoicePresenter = new InvoicePresenter(_mockCustomerRepository, _mockTaxesRepository, _mockInvoiceRepository, _mockInvoiceView); addInvoiceLineEventRaiser.Raise(_mockInvoiceView, EventArgs.Empty); }
private Invoice GetInvoice() { if (_invoice == null) { _invoice = new Invoice(_taxesRepository.GetTaxesService()); } return(_invoice); }