コード例 #1
0
        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);
        }
コード例 #2
0
        public void InvoiceCalculateTotalsEventDisplaysSubTotalTaxesAndTotal()
        {
            _mockInvoiceView.GetCustomer += null;
            LastCall.IgnoreArguments();
            _mockInvoiceView.AddInvoiceLine += null;
            LastCall.IgnoreArguments();
            _mockInvoiceView.CalculateTotals += null;
            var calculateTotalsEventRaiser = LastCall.IgnoreArguments().GetEventRaiser();

            _mockInvoiceView.SaveInvoice += null;
            LastCall.IgnoreArguments();

            ITaxesService taxesService = new TaxesService();

            Expect.Call(_mockTaxesRepository.GetTaxesService()).Return(taxesService);
            var invoice = new Invoice(taxesService);

            _mockInvoiceView.SubTotal        = invoice.SubTotal;
            _mockInvoiceView.TaxCalculations = invoice.TaxCalculations;
            _mockInvoiceView.Total           = invoice.Total;

            _mockRepository.ReplayAll();

            var invoicePresenter = new InvoicePresenter(_mockCustomerRepository, _mockTaxesRepository, _mockInvoiceRepository, _mockInvoiceView);

            calculateTotalsEventRaiser.Raise(_mockInvoiceView, EventArgs.Empty);
        }
コード例 #3
0
        public void InvoiceGetCustomerEventRetrievesCustomerInformation()
        {
            _mockInvoiceView.GetCustomer += null;
            var getCustomerEventRaiser = LastCall.IgnoreArguments().GetEventRaiser();

            _mockInvoiceView.AddInvoiceLine += null;
            LastCall.IgnoreArguments();
            _mockInvoiceView.CalculateTotals += null;
            LastCall.IgnoreArguments();
            _mockInvoiceView.SaveInvoice += null;
            LastCall.IgnoreArguments();

            const string customerCode = "JIMSMI";
            var          customer     = new Customer();

            Expect.Call(_mockInvoiceView.CustomerCode).Return(customerCode);
            Expect.Call(_mockCustomerRepository.FindCustomerByCode(customerCode)).Return(customer);
            _mockInvoiceView.CustomerFirstName = customer.FirstName;
            _mockInvoiceView.CustomerLastName  = customer.LastName;

            _mockRepository.ReplayAll();

            var invoicePresenter = new InvoicePresenter(_mockCustomerRepository, _mockTaxesRepository, _mockInvoiceRepository, _mockInvoiceView);

            getCustomerEventRaiser.Raise(_mockInvoiceView, EventArgs.Empty);
        }
コード例 #4
0
ファイル: frmAddInvoice.cs プロジェクト: uitstu/ushop
 public frmAddInvoice(Form caller, InvoicePresenter presenter)
 {
     this.caller    = caller;
     this.presenter = presenter;
     this.presenter.InvoiceAddingView = this;
     InitializeComponent();
     resetAll();
 }
コード例 #5
0
ファイル: frmAddInvoice.cs プロジェクト: uitstu/ushop
 public frmAddInvoice(Form caller, InvoicePresenter presenter, String invoiceCode)
 {
     this.caller    = caller;
     this.presenter = presenter;
     this.presenter.InvoiceAddingView = this;
     InitializeComponent();
     resetAll();
     presenter.loadExistedInvoice(invoiceCode);
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: fabio-neves/InvoiceReader
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var main            = new Main();
            var ea              = new InvoiceEventAggregator();
            var faturaPresenter = new InvoicePresenter(main, ea);

            ea.AddDataChangedEventHandler(faturaPresenter);
            ea.AddExportInvokedEndEventHandler(faturaPresenter);
            ea.AddFileChangedEventHandler(new PDFNewFormatReader());
            ea.AddExportInvokedEventHandler(new QifExport());
            Application.Run(main);
        }
コード例 #7
0
        public void InvoicePresenterAttachesAllViewEvents()
        {
            _mockInvoiceView.GetCustomer += null;
            LastCall.IgnoreArguments();
            _mockInvoiceView.AddInvoiceLine += null;
            LastCall.IgnoreArguments();
            _mockInvoiceView.CalculateTotals += null;
            LastCall.IgnoreArguments();
            _mockInvoiceView.SaveInvoice += null;
            LastCall.IgnoreArguments();

            _mockRepository.ReplayAll();

            var invoicePresenter = new InvoicePresenter(_mockCustomerRepository, _mockTaxesRepository, _mockInvoiceRepository, _mockInvoiceView);
        }
コード例 #8
0
ファイル: frmInvoice.cs プロジェクト: uitstu/ushop
        public frmInvoice()
        {
            presenter             = new InvoicePresenter(new InvoiceModel());
            presenter.InvoiceView = this;
            InitializeComponent();
            presenter.loadInvoiceList();

            GridView gridView = grdconILInvoice.FocusedView as GridView;

            foreach (GridColumn col in gridView.Columns)
            {
                col.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;
            }
            gridView.GroupPanelText = "Thả một tiêu đề ở đây để nhóm thông tin";
            //gridView.Columns["INVOICE_CODE"].SortOrder = DevExpress.Data.ColumnSortOrder.Descending;
        }
コード例 #9
0
        public void InvoiceSaveInvoiceToRepository()
        {
            _mockInvoiceView.GetCustomer += null;
            LastCall.IgnoreArguments();
            _mockInvoiceView.AddInvoiceLine += null;
            LastCall.IgnoreArguments();
            _mockInvoiceView.CalculateTotals += null;
            LastCall.IgnoreArguments();
            _mockInvoiceView.SaveInvoice += null;
            var saveInvoiceEventRaiser = LastCall.IgnoreArguments().GetEventRaiser();

            ITaxesService taxesService = new TaxesService();

            Expect.Call(_mockTaxesRepository.GetTaxesService()).Return(taxesService);
            var invoice = new Invoice(taxesService);

            _mockInvoiceRepository.SaveInvoice(invoice);

            _mockRepository.ReplayAll();

            var invoicePresenter = new InvoicePresenter(_mockCustomerRepository, _mockTaxesRepository, _mockInvoiceRepository, _mockInvoiceView);

            saveInvoiceEventRaiser.Raise(_mockInvoiceView, EventArgs.Empty);
        }