private void AssignSalesOrderDetails(SalesOrderVm viewModel, ISalesOrder salesOrder)
 {
     viewModel.SalesOrderId = salesOrder.SalesOrderId;
     viewModel.OrderNumber  = salesOrder.OrderNumber;
     viewModel.OrderDate    = salesOrder.OrderDate;
     viewModel.RequiredDate = salesOrder.RequiredDate;
     viewModel.DiscountRate = salesOrder.DiscountRate;
 }
 private void AssignTotals(SalesOrderVm viewModel, ISalesOrder salesOrder)
 {
     viewModel.SubTotal    = salesOrder.SubTotal;
     viewModel.TaxTotal    = salesOrder.TaxTotal;
     viewModel.Total       = salesOrder.Total;
     viewModel.Margin      = salesOrder.Margin;
     viewModel.Profit      = salesOrder.Profit;
     viewModel.TotalVolume = salesOrder.TotalVolume;
     viewModel.TotalWeight = salesOrder.TotalWeight;
 }
示例#3
0
        public void GetSalesOrder_Test03_ReturnViewModel()
        {
            var expected = new SalesOrderVm();

            _mockedSalesOrder.Setup(x => x.GetSalesOrderVm()).Returns(expected);

            var actual = _salesCommands.Get(Guid.NewGuid());

            Assert.That(actual == expected);
        }
        public void GetSalesOrderVm_Test03_ReturnSalesOrderVm()
        {
            var expected = new SalesOrderVm();

            _mockedSalesOrderVmBuilder.Setup(x => x.Build(_salesOrder)).Returns(expected);

            var actual = _salesOrder.GetSalesOrderVm();

            Assert.That(expected == actual);
        }
        public SalesOrderVm Build(ISalesOrder salesOrder)
        {
            if (salesOrder == null)
            {
                throw new SalesOrderCannotBeNullException();
            }

            var viewModel = new SalesOrderVm();

            AssignTotals(viewModel, salesOrder);
            AssignCustomerDetails(viewModel, salesOrder);
            AssignSalesInvoiceDetails(viewModel, salesOrder);
            AssignSalesOrderDetails(viewModel, salesOrder);

            return(viewModel);
        }
示例#6
0
        public void Build_Test11_ReturnBuildSalesOrderVm()
        {
            var salesOrderVm    = new SalesOrderVm();
            var addressVm       = new AddressVm();
            var currencyVm      = new CurrencyVm();
            var companyFeatures = new CompanyFeaturesVm();
            var salesTax        = new SalesTaxVm();

            _mockedSalesOrderVmModelBuilder.Setup(x => x.Build(_mockedSalesOrder.Object)).Returns(salesOrderVm);
            _mockedAddressVmModelBuilder.Setup(x => x.Build(_mockedSalesOrder.Object.DeliveryAddress)).Returns(addressVm);
            _mockedCurrencyVmModelBuilder.Setup(x => x.Build(_mockedSalesOrder.Object.Currency)).Returns(currencyVm);
            _mockedCompanyFeatureVmModelBuilder.Setup(x => x.Build(_mockedSalesOrder.Object.Customer.Company)).Returns(companyFeatures);
            _mockedSalesTaxVmModelBuilder.Setup(x => x.Build(_mockedSalesOrder.Object.SalesTax)).Returns(salesTax);

            var vm = _salesOrderVmBuilder.Build(_mockedSalesOrder.Object);

            Assert.That(vm, Is.EqualTo(salesOrderVm));
            Assert.That(vm.DeliveryAddress, Is.EqualTo(addressVm));
            Assert.That(vm.Currency, Is.EqualTo(currencyVm));
            Assert.That(vm.CompanyFeatures, Is.EqualTo(companyFeatures));
            Assert.That(vm.SalesTax, Is.EqualTo(salesTax));
        }
 private void AssignSalesInvoiceDetails(SalesOrderVm viewModel, ISalesOrder salesOrder)
 {
     viewModel.OpenSalesInvoiceCount = salesOrder.GetOpenInvoices().Count;
 }
 private void AssignCustomerDetails(SalesOrderVm viewModel, ISalesOrder salesOrder)
 {
     viewModel.CustomerCode     = salesOrder.Customer.CustomerCode;
     viewModel.PrintInvoice     = salesOrder.Customer.PrintInvoice;
     viewModel.PrintPackingSlip = salesOrder.Customer.PrintPackingSlip;
 }
示例#9
0
 private void LoadPageModel(Guid salesOrderId)
 {
     _salesOrder = GetSalesOrder.Get(salesOrderId);
 }