当前位置: 首页>>代码示例>>C#>>正文


C# SalesOrderItemBuilder类代码示例

本文整理汇总了C#中SalesOrderItemBuilder的典型用法代码示例。如果您正苦于以下问题:C# SalesOrderItemBuilder类的具体用法?C# SalesOrderItemBuilder怎么用?C# SalesOrderItemBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SalesOrderItemBuilder类属于命名空间,在下文中一共展示了SalesOrderItemBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SalesOrderItemBuilder

        public void GivenConfirmedOrderItemForGood_WhenOrderItemIsCancelled_ThenNonSerializedInventoryQuantitiesAreReleased()
        {
            this.InstantiateObjects(this.DatabaseSession);

            var item = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(this.good)
                .WithQuantityOrdered(3)
                .WithActualUnitPrice(5)
                .Build();

            this.order.AddSalesOrderItem(item);

            this.DatabaseSession.Derive(true);

            this.order.Confirm();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(item.QuantityOrdered, item.ReservedFromInventoryItem.QuantityCommittedOut);
            Assert.AreEqual(0, item.ReservedFromInventoryItem.AvailableToPromise);

            var previous = item.ReservedFromInventoryItem;

            this.DatabaseSession.Derive(true);

            item.Cancel();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(0, previous.QuantityCommittedOut);
            Assert.AreEqual(0, previous.AvailableToPromise);
        }
开发者ID:Allors,项目名称:apps,代码行数:32,代码来源:SalesOrderItemTests.cs

示例2: GivenOrderRequirementCommitment_WhenDeriving_ThenRequiredRelationsMustExist

        public void GivenOrderRequirementCommitment_WhenDeriving_ThenRequiredRelationsMustExist()
        {
            var shipToCustomer = new OrganisationBuilder(this.DatabaseSession).WithName("shipToCustomer").Build();
            var billToCustomer = new OrganisationBuilder(this.DatabaseSession).WithName("billToCustomer").Build();

            new CustomerRelationshipBuilder(this.DatabaseSession)
                .WithCustomer(billToCustomer)
                .WithInternalOrganisation(Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation)
                .Build();

            new CustomerRelationshipBuilder(this.DatabaseSession)
                .WithCustomer(shipToCustomer)
                .WithInternalOrganisation(Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation)
                .Build();

            var vatRate21 = new VatRateBuilder(this.DatabaseSession).WithRate(21).Build();
            var good = new GoodBuilder(this.DatabaseSession)
                .WithName("Gizmo")
                .WithSku("10101")
                .WithVatRate(vatRate21)
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.DatabaseSession.Derive(true);

            var salesOrder = new SalesOrderBuilder(this.DatabaseSession)
                .WithShipToCustomer(shipToCustomer)
                .WithBillToCustomer(billToCustomer)
                .WithVatRegime(new VatRegimes(this.DatabaseSession).Export)
                .Build();

            var goodOrderItem = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good).WithQuantityOrdered(1).Build();
            salesOrder.AddSalesOrderItem(goodOrderItem);

            var customerRequirement = new CustomerRequirementBuilder(this.DatabaseSession).WithDescription("100 gizmo's").Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            var builder = new OrderRequirementCommitmentBuilder(this.DatabaseSession);
            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithOrderItem(goodOrderItem);
            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithRequirement(customerRequirement);
            var tsts = builder.Build();

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);
        }
开发者ID:Allors,项目名称:apps,代码行数:59,代码来源:OrderRequirementCommitmentTests.cs

示例3: GivenPartyWithOpenOrders_WhenDeriving_ThenOpenOrderAmountIsUpdated

        public void GivenPartyWithOpenOrders_WhenDeriving_ThenOpenOrderAmountIsUpdated()
        {
            var organisation = new OrganisationBuilder(this.DatabaseSession).WithName("customer").Build();
            var internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");
            new CustomerRelationshipBuilder(this.DatabaseSession).WithCustomer(organisation).WithInternalOrganisation(internalOrganisation).Build();

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();

            var postalAddress = new PostalAddressBuilder(this.DatabaseSession)
                  .WithAddress1("Kleine Nieuwedijkstraat 2")
                  .WithGeographicBoundary(mechelen)
                  .Build();

            var good = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithVatRate(new VatRateBuilder(this.DatabaseSession).WithRate(21).Build())
                .WithName("good")
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.DatabaseSession.Derive(true);

            var salesOrder1 = new SalesOrderBuilder(this.DatabaseSession).WithBillToCustomer(organisation).WithShipToAddress(postalAddress).WithComment("salesorder1").Build();
            var orderItem1 = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(good)
                .WithQuantityOrdered(10)
                .WithActualUnitPrice(10)
                .Build();
            salesOrder1.AddSalesOrderItem(orderItem1);

            var salesOrder2 = new SalesOrderBuilder(this.DatabaseSession).WithBillToCustomer(organisation).WithShipToAddress(postalAddress).WithComment("salesorder2").Build();
            var orderItem2 = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(good)
                .WithQuantityOrdered(10)
                .WithActualUnitPrice(10)
                .Build();
            salesOrder2.AddSalesOrderItem(orderItem2);

            var salesOrder3 = new SalesOrderBuilder(this.DatabaseSession).WithBillToCustomer(organisation).WithShipToAddress(postalAddress).WithComment("salesorder3").Build();
            var orderItem3 = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(good)
                .WithQuantityOrdered(10)
                .WithActualUnitPrice(10)
                .Build();
            salesOrder3.AddSalesOrderItem(orderItem3);
            salesOrder3.Cancel();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(242M, organisation.OpenOrderAmount);
        }
开发者ID:Allors,项目名称:apps,代码行数:52,代码来源:PartyTests.cs

示例4: InventoryItemVarianceBuilder

        public void GivenOrderItemWithPendingShipmentAndAssignedPickList_WhenQuantityOrderedIsDecreased_ThenNegativePickListIsCreatedAndShipmentQuantityIsDecreased()
        {
            this.InstantiateObjects(this.DatabaseSession);

            var inventoryItem = (NonSerializedInventoryItem)this.part.InventoryItemsWherePart.First;
            inventoryItem.AddInventoryItemVariance(new InventoryItemVarianceBuilder(this.DatabaseSession).WithQuantity(10).WithReason(new VarianceReasons(this.DatabaseSession).Unknown).Build());

            this.DatabaseSession.Derive(true);

            var item = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(this.good)
                .WithQuantityOrdered(10)
                .WithActualUnitPrice(5)
                .Build();

            this.order.AddSalesOrderItem(item);

            this.DatabaseSession.Derive(true);

            this.order.Confirm();

            this.DatabaseSession.Derive(true);

            var shipment = (CustomerShipment)item.OrderShipmentsWhereSalesOrderItem[0].ShipmentItem.ShipmentWhereShipmentItem;
            Assert.AreEqual(10, shipment.ShipmentItems[0].Quantity);

            var pickList = shipment.ShipmentItems[0].ItemIssuancesWhereShipmentItem[0].PickListItem.PickListWherePickListItem;
            Assert.AreEqual(10, pickList.PickListItems[0].RequestedQuantity);

            pickList.Picker = new Persons(this.DatabaseSession).FindBy(Persons.Meta.LastName, "orderProcessor");

            this.DatabaseSession.Derive(true);

            item.QuantityOrdered = 3;

            this.DatabaseSession.Derive(true);

            var negativePickList = this.order.ShipToCustomer.PickListsWhereShipToParty[1];

            Assert.AreEqual(3, shipment.ShipmentItems[0].Quantity);
            Assert.AreEqual(10, pickList.PickListItems[0].RequestedQuantity);
            Assert.AreEqual(-7, negativePickList.PickListItems[0].RequestedQuantity);
        }
开发者ID:Allors,项目名称:apps,代码行数:43,代码来源:SalesOrderItemTests.cs

示例5: GivenOrderItemWithoutShipToParty_WhenDeriving_ThenDerivedShipToPartyIsFromOrder

        public void GivenOrderItemWithoutShipToParty_WhenDeriving_ThenDerivedShipToPartyIsFromOrder()
        {
            this.InstantiateObjects(this.DatabaseSession);

            var salesOrder = new SalesOrderBuilder(this.DatabaseSession)
                .WithTakenByInternalOrganisation(this.internalOrganisation)
                .WithShipToCustomer(this.shipToCustomer)
                .WithBillToCustomer(this.billToCustomer)
                .Build();

            var orderItem = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(this.good).WithQuantityOrdered(1).Build();
            salesOrder.AddSalesOrderItem(orderItem);

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(this.shipToCustomer, orderItem.ShipToParty);
        }
开发者ID:Allors,项目名称:apps,代码行数:17,代码来源:SalesOrderItemTests.cs

示例6: GivenOrderItemForProductWithoutCategory_WhenDerivingSalesRep_ThenSalesRepForCustomerIsSelected

        public void GivenOrderItemForProductWithoutCategory_WhenDerivingSalesRep_ThenSalesRepForCustomerIsSelected()
        {
            this.InstantiateObjects(this.DatabaseSession);

            var salesrep1 = new PersonBuilder(this.DatabaseSession).WithLastName("salesrep for child product category").Build();
            var salesrep2 = new PersonBuilder(this.DatabaseSession).WithLastName("salesrep for parent category").Build();
            var salesrep3 = new PersonBuilder(this.DatabaseSession).WithLastName("salesrep for everything else").Build();
            var productCategoryParent = new ProductCategoryBuilder(this.DatabaseSession).WithDescription("parent").Build();
            var childProductCategory = new ProductCategoryBuilder(this.DatabaseSession).WithDescription("child").WithParent(productCategoryParent).Build();

            new SalesRepRelationshipBuilder(this.DatabaseSession)
                .WithSalesRepresentative(salesrep1)
                .WithCustomer(this.order.ShipToCustomer)
                .WithProductCategory(childProductCategory)
                .WithFromDate(DateTime.UtcNow.AddMinutes(-1))
                .Build();

            new SalesRepRelationshipBuilder(this.DatabaseSession)
                .WithSalesRepresentative(salesrep2)
                .WithCustomer(this.order.ShipToCustomer)
                .WithProductCategory(productCategoryParent)
                .WithFromDate(DateTime.UtcNow.AddMinutes(-1))
                .Build();

            new SalesRepRelationshipBuilder(this.DatabaseSession)
                .WithSalesRepresentative(salesrep3)
                .WithCustomer(this.order.ShipToCustomer)
                .WithFromDate(DateTime.UtcNow.AddMinutes(-1))
                .Build();

            var orderItem = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(this.good)
                .WithQuantityOrdered(3)
                .WithActualUnitPrice(5)
                .Build();

            this.order.AddSalesOrderItem(orderItem);

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(orderItem.SalesRep, salesrep3);
        }
开发者ID:Allors,项目名称:apps,代码行数:42,代码来源:SalesOrderItemTests.cs

示例7: GivenInventoryItem_WhenQuantityOnHandIsRaised_ThenSalesOrderItemsWithQuantityShortFalledAreUpdated

        public void GivenInventoryItem_WhenQuantityOnHandIsRaised_ThenSalesOrderItemsWithQuantityShortFalledAreUpdated()
        {
            var vatRate21 = new VatRateBuilder(this.DatabaseSession).WithRate(21).Build();

            var category = new ProductCategoryBuilder(this.DatabaseSession).WithDescription("category").Build();

            var good = new GoodBuilder(this.DatabaseSession)
             .WithSku("10101")
             .WithVatRate(vatRate21)
             .WithName("good1")
             .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
             .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
             .WithPrimaryProductCategory(category)
             .Build();

            var inventoryItem = new NonSerializedInventoryItemBuilder(this.DatabaseSession).WithGood(good).Build();
            inventoryItem.AddInventoryItemVariance(new InventoryItemVarianceBuilder(this.DatabaseSession).WithQuantity(5).WithReason(new VarianceReasons(this.DatabaseSession).Unknown).Build());

            this.DatabaseSession.Derive(true);

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            var mechelenAddress = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build();
            var shipToMechelen = new PartyContactMechanismBuilder(this.DatabaseSession)
                .WithContactMechanism(mechelenAddress)
                .WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).ShippingAddress)
                .WithUseAsDefault(true)
                .Build();

            var customer = new PersonBuilder(this.DatabaseSession).WithLastName("customer").WithPartyContactMechanism(shipToMechelen).Build();

            var internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");

            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(customer).WithInternalOrganisation(internalOrganisation).Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            var order1 = new SalesOrderBuilder(this.DatabaseSession)
                .WithBillToCustomer(customer)
                .WithShipToCustomer(customer)
                .WithDeliveryDate(DateTime.UtcNow)
                .Build();

            var item1 = new SalesOrderItemBuilder(this.DatabaseSession).WithDescription("item1").WithProduct(good).WithQuantityOrdered(10).WithActualUnitPrice(15).Build();
            var item2 = new SalesOrderItemBuilder(this.DatabaseSession).WithDescription("item2").WithProduct(good).WithQuantityOrdered(20).WithActualUnitPrice(15).Build();
            order1.AddSalesOrderItem(item1);
            order1.AddSalesOrderItem(item2);

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            order1.Confirm();

            this.DatabaseSession.Derive(true);

            var order2 = new SalesOrderBuilder(this.DatabaseSession)
                .WithBillToCustomer(customer)
                .WithShipToCustomer(customer)
                .WithDeliveryDate(DateTime.UtcNow.AddDays(1))
                .Build();

            var item3 = new SalesOrderItemBuilder(this.DatabaseSession).WithDescription("item3").WithProduct(good).WithQuantityOrdered(10).WithActualUnitPrice(15).Build();
            var item4 = new SalesOrderItemBuilder(this.DatabaseSession).WithDescription("item4").WithProduct(good).WithQuantityOrdered(20).WithActualUnitPrice(15).Build();
            order2.AddSalesOrderItem(item3);
            order2.AddSalesOrderItem(item4);

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            order2.Confirm();

            this.DatabaseSession.Derive(true);

            //Assert.AreEqual(0, item1.QuantityRequestsShipping);
            //Assert.AreEqual(5, item1.QuantityPendingShipment);
            //Assert.AreEqual(10, item1.QuantityReserved);
            //Assert.AreEqual(5, item1.QuantityShortFalled);

            //Assert.AreEqual(0, item2.QuantityRequestsShipping);
            //Assert.AreEqual(0, item2.QuantityPendingShipment);
            //Assert.AreEqual(20, item2.QuantityReserved);
            //Assert.AreEqual(20, item2.QuantityShortFalled);

            //Assert.AreEqual(0, item3.QuantityRequestsShipping);
            //Assert.AreEqual(0, item3.QuantityPendingShipment);
            //Assert.AreEqual(10, item3.QuantityReserved);
            //Assert.AreEqual(10, item3.QuantityShortFalled);

            //Assert.AreEqual(0, item4.QuantityRequestsShipping);
            //Assert.AreEqual(0, item4.QuantityPendingShipment);
            //Assert.AreEqual(20, item4.QuantityReserved);
            //Assert.AreEqual(20, item4.QuantityShortFalled);

            Assert.AreEqual(0, item1.ReservedFromInventoryItem.AvailableToPromise);
            Assert.AreEqual(5, item1.ReservedFromInventoryItem.QuantityOnHand);

            inventoryItem.AddInventoryItemVariance(new InventoryItemVarianceBuilder(this.DatabaseSession).WithQuantity(15).WithReason(new VarianceReasons(this.DatabaseSession).Unknown).Build());

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();
//.........这里部分代码省略.........
开发者ID:Allors,项目名称:apps,代码行数:101,代码来源:NonSerializedInventoryItemTests.cs

示例8: GivenSalesOrderForItemsThatAreAvailable_WhenShipped_ThenOrderIsCompleted

        public void GivenSalesOrderForItemsThatAreAvailable_WhenShipped_ThenOrderIsCompleted()
        {
            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            var mechelenAddress = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build();
            var shipToMechelen = new PartyContactMechanismBuilder(this.DatabaseSession)
                .WithContactMechanism(mechelenAddress)
                .WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).ShippingAddress)
                .WithUseAsDefault(true)
                .Build();

            var billToMechelen = new PartyContactMechanismBuilder(this.DatabaseSession)
                .WithContactMechanism(mechelenAddress)
                .WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).BillingAddress)
                .WithUseAsDefault(true)
                .Build();

            var customer = new PersonBuilder(this.DatabaseSession).WithLastName("customer").WithPartyContactMechanism(shipToMechelen).WithPartyContactMechanism(billToMechelen).Build();
            var internalOrganisation = Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation;

            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(customer).WithInternalOrganisation(internalOrganisation).Build();

            var vatRate21 = new VatRateBuilder(this.DatabaseSession).WithRate(21).Build();

            var good1 = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithVatRate(vatRate21)
                .WithName("good1")
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .Build();

            var good2 = new GoodBuilder(this.DatabaseSession)
                .WithSku("10102")
                .WithVatRate(vatRate21)
                .WithName("good2")
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .Build();

            var good1InventoryItem = new NonSerializedInventoryItemBuilder(this.DatabaseSession).WithGood(good1).Build();
            good1InventoryItem.AddInventoryItemVariance(new InventoryItemVarianceBuilder(this.DatabaseSession).WithQuantity(100).WithReason(new VarianceReasons(this.DatabaseSession).Unknown).Build());

            this.DatabaseSession.Derive(true);

            var good2InventoryItem = new NonSerializedInventoryItemBuilder(this.DatabaseSession).WithGood(good2).Build();
            good2InventoryItem.AddInventoryItemVariance(new InventoryItemVarianceBuilder(this.DatabaseSession).WithQuantity(100).WithReason(new VarianceReasons(this.DatabaseSession).Unknown).Build());

            this.DatabaseSession.Derive(true);

            var order = new SalesOrderBuilder(this.DatabaseSession)
                .WithBillToCustomer(customer)
                .WithShipToCustomer(customer)
                .WithShipToAddress(mechelenAddress)
                .Build();

            var item1 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good1).WithQuantityOrdered(1).WithActualUnitPrice(15).Build();
            var item2 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good1).WithQuantityOrdered(2).WithActualUnitPrice(15).Build();
            var item3 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good2).WithQuantityOrdered(5).WithActualUnitPrice(15).Build();
            order.AddSalesOrderItem(item1);
            order.AddSalesOrderItem(item2);
            order.AddSalesOrderItem(item3);

            this.DatabaseSession.Derive(true);

            order.Confirm();

            this.DatabaseSession.Derive(true);

            var shipment = (CustomerShipment)mechelenAddress.ShipmentsWhereShipToAddress[0];

            var pickList = shipment.ShipmentItems[0].ItemIssuancesWhereShipmentItem[0].PickListItem.PickListWherePickListItem;
            pickList.Picker = new Persons(this.DatabaseSession).FindBy(Persons.Meta.LastName, "orderProcessor");

            pickList.SetPicked();
            this.DatabaseSession.Derive(true);

            var package = new ShipmentPackageBuilder(this.DatabaseSession).Build();
            shipment.AddShipmentPackage(package);

            foreach (ShipmentItem shipmentItem in shipment.ShipmentItems)
            {
                package.AddPackagingContent(new PackagingContentBuilder(this.DatabaseSession).WithShipmentItem(shipmentItem).WithQuantity(shipmentItem.Quantity).Build());
            }

            this.DatabaseSession.Derive(true);

            shipment.Ship();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(new SalesOrderObjectStates(this.DatabaseSession).Completed, order.CurrentObjectState);
            Assert.AreEqual(new SalesOrderObjectStates(this.DatabaseSession).Shipped, order.CurrentShipmentStatus.SalesOrderObjectState);
            Assert.IsFalse(order.ExistCurrentPaymentStatus);
            Assert.AreEqual(new SalesOrderItemObjectStates(this.DatabaseSession).Completed, item1.CurrentObjectState);
            Assert.IsFalse(item1.ExistCurrentPaymentStatus);
            Assert.AreEqual(new SalesOrderItemObjectStates(this.DatabaseSession).Shipped, item1.CurrentShipmentStatus.SalesOrderItemObjectState);
            Assert.AreEqual(new SalesOrderItemObjectStates(this.DatabaseSession).Completed, item2.CurrentObjectState);
            Assert.IsFalse(item2.ExistCurrentPaymentStatus);
            Assert.AreEqual(new SalesOrderItemObjectStates(this.DatabaseSession).Shipped, item2.CurrentShipmentStatus.SalesOrderItemObjectState);
            Assert.AreEqual(new SalesOrderItemObjectStates(this.DatabaseSession).Completed, item3.CurrentObjectState);
//.........这里部分代码省略.........
开发者ID:Allors,项目名称:apps,代码行数:101,代码来源:SalesOrderTests.cs

示例9: GivenSalesOrderForCustomerExceedingCreditLimit_WhenOrderIsConfirmed_ThenOrderRequestsApproval

        public void GivenSalesOrderForCustomerExceedingCreditLimit_WhenOrderIsConfirmed_ThenOrderRequestsApproval()
        {
            var productItem = new SalesInvoiceItemTypes(this.DatabaseSession).ProductItem;
            var contactMechanism = new ContactMechanisms(this.DatabaseSession).Extent().First;

            var assessable = new VatRegimes(this.DatabaseSession).Assessable;
            var vatRate0 = new VatRateBuilder(this.DatabaseSession).WithRate(0).Build();
            assessable.VatRate = vatRate0;

            var good = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithVatRate(vatRate0)
                .WithName("good1")
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .Build();

            var inventoryItem = new NonSerializedInventoryItemBuilder(this.DatabaseSession).WithGood(good).Build();
            inventoryItem.AddInventoryItemVariance(new InventoryItemVarianceBuilder(this.DatabaseSession).WithQuantity(100).WithReason(new VarianceReasons(this.DatabaseSession).Unknown).Build());

            this.DatabaseSession.Derive(true);

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            var mechelenAddress = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build();
            var shipToMechelen = new PartyContactMechanismBuilder(this.DatabaseSession)
                .WithContactMechanism(mechelenAddress)
                .WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).ShippingAddress)
                .WithUseAsDefault(true)
                .Build();

            var customer = new PersonBuilder(this.DatabaseSession).WithLastName("customer").WithPartyContactMechanism(shipToMechelen).Build();

            new CustomerRelationshipBuilder(this.DatabaseSession)
                .WithCustomer(customer)
                .WithInternalOrganisation(Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation)
                .WithCreditLimit(100M)
                .Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            var invoice = new SalesInvoiceBuilder(this.DatabaseSession)
                .WithSalesInvoiceType(new SalesInvoiceTypes(this.DatabaseSession).SalesInvoice)
                .WithBillToCustomer(customer)
                .WithBillToContactMechanism(contactMechanism)
                .WithInvoiceDate(DateTime.UtcNow.AddYears(-1))
                .Build();

            var invoiceItem = new SalesInvoiceItemBuilder(this.DatabaseSession).WithProduct(good).WithQuantity(10).WithActualUnitPrice(11).WithSalesInvoiceItemType(productItem).Build();
            invoice.AddSalesInvoiceItem(invoiceItem);

            this.DatabaseSession.Derive(true);

            var order = new SalesOrderBuilder(this.DatabaseSession)
                .WithBillToCustomer(customer)
                .WithShipToCustomer(customer)
                .WithVatRegime(assessable)
                .WithShipToAddress(new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build())
                .Build();

            var item = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(good)
                .WithQuantityOrdered(10)
                .WithActualUnitPrice(5)
                .Build();

            order.AddSalesOrderItem(item);

            this.DatabaseSession.Derive(true);

            order.Confirm();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(new SalesOrderObjectStates(this.DatabaseSession).RequestsApproval, order.CurrentObjectState);
            Assert.AreEqual(0, item.QuantityReserved);
            Assert.AreEqual(0, item.QuantityPendingShipment);
            Assert.AreEqual(0, item.QuantityRequestsShipping);
            Assert.AreEqual(0, item.QuantityShortFalled);

            order.Approve();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(new SalesOrderObjectStates(this.DatabaseSession).InProcess, order.CurrentObjectState);
            Assert.AreEqual(10, item.QuantityReserved);
            Assert.AreEqual(10, item.QuantityPendingShipment);
            Assert.AreEqual(0, item.QuantityRequestsShipping);
            Assert.AreEqual(0, item.QuantityShortFalled);
        }
开发者ID:Allors,项目名称:apps,代码行数:90,代码来源:SalesOrderTests.cs

示例10: GivenConfirmedOrder_WhenOrderIsCancelled_ThenNonSerializedInventoryQuantitiesAreReleased

        public void GivenConfirmedOrder_WhenOrderIsCancelled_ThenNonSerializedInventoryQuantitiesAreReleased()
        {
            var billToCustomer = new PersonBuilder(this.DatabaseSession).WithLastName("person1").Build();
            var shipToCustomer = new PersonBuilder(this.DatabaseSession).WithLastName("person2").Build();
            var internalOrganisation = Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation;

            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(billToCustomer).WithInternalOrganisation(internalOrganisation).Build();
            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(shipToCustomer).WithInternalOrganisation(internalOrganisation).Build();

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            var shipToContactMechanism = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build();

            var vatRate21 = new VatRateBuilder(this.DatabaseSession).WithRate(21).Build();
            var part1 = new FinishedGoodBuilder(this.DatabaseSession).WithName("part1").Build();
            var part2 = new FinishedGoodBuilder(this.DatabaseSession).WithName("part2").Build();

            var good1 = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithVatRate(vatRate21)
                .WithName("good1")
                .WithFinishedGood(part1)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            var good2 = new GoodBuilder(this.DatabaseSession)
                .WithSku("10102")
                .WithVatRate(vatRate21)
                .WithName("good1")
                .WithFinishedGood(part2)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.DatabaseSession.Derive(true);

            var order = new SalesOrderBuilder(this.DatabaseSession)
                .WithBillToCustomer(billToCustomer)
                .WithShipToCustomer(shipToCustomer)
                .WithShipToAddress(shipToContactMechanism)
                .Build();

            var item1 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good1).WithQuantityOrdered(1).WithActualUnitPrice(15).Build();
            var item2 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good1).WithQuantityOrdered(2).WithActualUnitPrice(15).Build();
            var item3 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good2).WithQuantityOrdered(3).WithActualUnitPrice(15).Build();
            var item4 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good2).WithQuantityOrdered(4).WithActualUnitPrice(15).Build();
            order.AddSalesOrderItem(item1);
            order.AddSalesOrderItem(item2);
            order.AddSalesOrderItem(item3);
            order.AddSalesOrderItem(item4);

            this.DatabaseSession.Derive(true);

            order.Confirm();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(3, item1.ReservedFromInventoryItem.QuantityCommittedOut);
            Assert.AreEqual(0, item1.ReservedFromInventoryItem.AvailableToPromise);
            Assert.AreEqual(7, item3.ReservedFromInventoryItem.QuantityCommittedOut);
            Assert.AreEqual(0, item3.ReservedFromInventoryItem.AvailableToPromise);

            order.Cancel();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(0, item1.ReservedFromInventoryItem.QuantityCommittedOut);
            Assert.AreEqual(0, item1.ReservedFromInventoryItem.AvailableToPromise);
            Assert.AreEqual(0, item3.ReservedFromInventoryItem.QuantityCommittedOut);
            Assert.AreEqual(0, item3.ReservedFromInventoryItem.AvailableToPromise);
        }
开发者ID:Allors,项目名称:apps,代码行数:69,代码来源:SalesOrderTests.cs

示例11: GivenSalesOrder_WhenOrderItemIsWithoutBasePrice_ThenItemIsInvalid

        public void GivenSalesOrder_WhenOrderItemIsWithoutBasePrice_ThenItemIsInvalid()
        {
            var billToCustomer = new PersonBuilder(this.DatabaseSession).WithLastName("person1").Build();
            var shipToCustomer = new PersonBuilder(this.DatabaseSession).WithLastName("person2").Build();
            var internalOrganisation = Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation;

            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(billToCustomer).WithInternalOrganisation(internalOrganisation).Build();
            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(shipToCustomer).WithInternalOrganisation(internalOrganisation).Build();

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            var vatRate21 = new VatRateBuilder(this.DatabaseSession).WithRate(21).Build();
            var part1 = new FinishedGoodBuilder(this.DatabaseSession).WithName("part1").Build();
            var part2 = new FinishedGoodBuilder(this.DatabaseSession).WithName("part2").Build();

            var good1 = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithVatRate(vatRate21)
                .WithName("good1")
                .WithFinishedGood(part1)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            var good2 = new GoodBuilder(this.DatabaseSession)
                .WithSku("10102")
                .WithVatRate(vatRate21)
                .WithName("good1")
                .WithFinishedGood(part2)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.DatabaseSession.Derive(true);

            var order = new SalesOrderBuilder(this.DatabaseSession)
                .WithBillToCustomer(billToCustomer)
                .WithShipToCustomer(shipToCustomer)
                .WithShipToAddress(new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build())
                .Build();

            var item1 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good1).WithQuantityOrdered(1).WithActualUnitPrice(15).Build();
            var item2 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good1).WithQuantityOrdered(2).WithActualUnitPrice(15).Build();
            var item3 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good2).WithQuantityOrdered(3).WithActualUnitPrice(15).Build();
            var item4 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good2).WithQuantityOrdered(4).WithActualUnitPrice(15).Build();
            order.AddSalesOrderItem(item1);
            order.AddSalesOrderItem(item2);
            order.AddSalesOrderItem(item3);
            order.AddSalesOrderItem(item4);

            order.Confirm();

            this.DatabaseSession.Derive(true);

            item4.RemoveActualUnitPrice();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(0, item4.UnitBasePrice);
            Assert.AreEqual(3, order.ValidOrderItems.Count);
            Assert.Contains(item1, order.ValidOrderItems);
            Assert.Contains(item2, order.ValidOrderItems);
            Assert.Contains(item3, order.ValidOrderItems);
        }
开发者ID:Allors,项目名称:apps,代码行数:61,代码来源:SalesOrderTests.cs

示例12: GivenSalesOrder_WhenDerivingSalesReps_ThenSalesRepsAreCollectedFromSalesOrderItems

        public void GivenSalesOrder_WhenDerivingSalesReps_ThenSalesRepsAreCollectedFromSalesOrderItems()
        {
            var salesrep1 = new PersonBuilder(this.DatabaseSession).WithLastName("salesrep for child product category").Build();
            var salesrep2 = new PersonBuilder(this.DatabaseSession).WithLastName("salesrep for parent category").Build();
            var salesrep3 = new PersonBuilder(this.DatabaseSession).WithLastName("salesrep for everything else").Build();
            var parentProductCategory = new ProductCategoryBuilder(this.DatabaseSession).WithDescription("parent").Build();
            var childProductCategory = new ProductCategoryBuilder(this.DatabaseSession).WithDescription("child").WithParent(parentProductCategory).Build();

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();

            var customer = new OrganisationBuilder(this.DatabaseSession).WithName("company").Build();
            var internalOrganisation = Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation;

            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(customer).WithInternalOrganisation(internalOrganisation).Build();

            new SalesRepRelationshipBuilder(this.DatabaseSession)
                .WithSalesRepresentative(salesrep1)
                .WithCustomer(customer)
                .WithProductCategory(childProductCategory)
                .Build();

            new SalesRepRelationshipBuilder(this.DatabaseSession)
                .WithSalesRepresentative(salesrep2)
                .WithCustomer(customer)
                .WithProductCategory(parentProductCategory)
                .Build();

            new SalesRepRelationshipBuilder(this.DatabaseSession)
                .WithSalesRepresentative(salesrep3)
                .WithCustomer(customer)
                .Build();

            var good1 = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithName("good")
                .WithVatRate(new VatRateBuilder(this.DatabaseSession).WithRate(21).Build())
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .WithProductCategory(childProductCategory)
                .Build();

            var good2 = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithName("good")
                .WithVatRate(new VatRateBuilder(this.DatabaseSession).WithRate(21).Build())
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .WithProductCategory(parentProductCategory)
                .Build();

            var good3 = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithName("good")
                .WithVatRate(new VatRateBuilder(this.DatabaseSession).WithRate(21).Build())
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.DatabaseSession.Derive(true);

            var order = new SalesOrderBuilder(this.DatabaseSession)
                .WithBillToCustomer(customer)
                .WithShipToCustomer(customer)
                .WithShipToAddress(new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build())
                .Build();

            var item1 = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(good1)
                .WithQuantityOrdered(3)
                .WithActualUnitPrice(5)
                .Build();

            order.AddSalesOrderItem(item1);

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(1, order.SalesReps.Count);
            Assert.Contains(salesrep1, order.SalesReps);

            var item2 = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(good2)
                .WithQuantityOrdered(3)
                .WithActualUnitPrice(5)
                .Build();

            order.AddSalesOrderItem(item2);

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(2, order.SalesReps.Count);
            Assert.Contains(salesrep1, order.SalesReps);
            Assert.Contains(salesrep2, order.SalesReps);

            var item3 = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(good3)
                .WithQuantityOrdered(3)
                .WithActualUnitPrice(5)
                .Build();

            order.AddSalesOrderItem(item3);
//.........这里部分代码省略.........
开发者ID:Allors,项目名称:apps,代码行数:101,代码来源:SalesOrderTests.cs

示例13: GivenSalesOrderBelowOrderThreshold_WhenOrderIsConfirmed_ThenOrderIsNotShipped

        public void GivenSalesOrderBelowOrderThreshold_WhenOrderIsConfirmed_ThenOrderIsNotShipped()
        {
            Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation.StoresWhereOwner.First.OrderThreshold = 1;

            var assessable = new VatRegimes(this.DatabaseSession).Assessable;
            var vatRate0 = new VatRateBuilder(this.DatabaseSession).WithRate(0).Build();
            assessable.VatRate = vatRate0;

            var good = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithVatRate(vatRate0)
                .WithName("good1")
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .Build();

            var inventoryItem = new NonSerializedInventoryItemBuilder(this.DatabaseSession).WithGood(good).Build();
            inventoryItem.AddInventoryItemVariance(new InventoryItemVarianceBuilder(this.DatabaseSession).WithQuantity(100).WithReason(new VarianceReasons(this.DatabaseSession).Unknown).Build());

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            var mechelenAddress = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build();
            var shipToMechelen = new PartyContactMechanismBuilder(this.DatabaseSession)
                .WithContactMechanism(mechelenAddress)
                .WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).ShippingAddress)
                .WithUseAsDefault(true)
                .Build();

            var customer = new PersonBuilder(this.DatabaseSession).WithLastName("customer").WithPartyContactMechanism(shipToMechelen).Build();

            new CustomerRelationshipBuilder(this.DatabaseSession)
                .WithCustomer(customer)
                .WithInternalOrganisation(Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation)
                .Build();

            this.DatabaseSession.Derive(true);

            var order = new SalesOrderBuilder(this.DatabaseSession)
                .WithBillToCustomer(customer)
                .WithShipToCustomer(customer)
                .WithVatRegime(assessable)
                .WithShipToAddress(new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build())
                .Build();

            var item = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(good)
                .WithQuantityOrdered(1)
                .WithActualUnitPrice(0.1M)
                .Build();

            order.AddSalesOrderItem(item);

            this.DatabaseSession.Derive(true);

            order.Confirm();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(new SalesOrderObjectStates(this.DatabaseSession).RequestsApproval, order.CurrentObjectState);
        }
开发者ID:Allors,项目名称:apps,代码行数:59,代码来源:SalesOrderTests.cs

示例14: WarehouseBuilder

        public void GivenConfirmedOrderItemForGood_WhenReservedFromInventoryItemChangesValue_ThenQuantitiesAreMovedFromOldToNewInventoryItem()
        {
            this.InstantiateObjects(this.DatabaseSession);

            var secondWarehouse = new WarehouseBuilder(this.DatabaseSession)
                .WithName("affiliate warehouse")
                .WithOwner(this.internalOrganisation)
                .Build();

            var item = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(this.good)
                .WithQuantityOrdered(3)
                .WithActualUnitPrice(5)
                .Build();

            this.order.AddSalesOrderItem(item);

            this.DatabaseSession.Derive(true);

            this.order.Confirm();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(3, item.QuantityOrdered);
            Assert.AreEqual(0, item.QuantityPicked);
            Assert.AreEqual(0, item.QuantityShipped);
            Assert.AreEqual(0, item.QuantityPendingShipment);
            Assert.AreEqual(0, item.QuantityPendingShipment);
            Assert.AreEqual(3, item.QuantityReserved);
            Assert.AreEqual(3, item.QuantityShortFalled);
            Assert.AreEqual(0, item.QuantityRequestsShipping);
            Assert.AreEqual(3, item.ReservedFromInventoryItem.QuantityCommittedOut);
            Assert.AreEqual(0, item.ReservedFromInventoryItem.AvailableToPromise);
            Assert.AreEqual(0, item.ReservedFromInventoryItem.QuantityOnHand);

            var previous = item.ReservedFromInventoryItem;
            var current = new NonSerializedInventoryItemBuilder(this.DatabaseSession).WithFacility(secondWarehouse).WithPart(this.part).Build();

            item.ReservedFromInventoryItem = current;

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(3, item.QuantityOrdered);
            Assert.AreEqual(0, item.QuantityPicked);
            Assert.AreEqual(0, item.QuantityShipped);
            Assert.AreEqual(3, item.QuantityReserved);
            Assert.AreEqual(3, item.QuantityShortFalled);
            Assert.AreEqual(0, item.QuantityRequestsShipping);
            Assert.AreEqual(0, previous.QuantityCommittedOut);
            Assert.AreEqual(0, previous.AvailableToPromise);
            Assert.AreEqual(3, current.QuantityCommittedOut);
            Assert.AreEqual(0, current.AvailableToPromise);
        }
开发者ID:Allors,项目名称:apps,代码行数:53,代码来源:SalesOrderItemTests.cs

示例15: GivenConfirmedOrderItemForGood_WhenShipmentIsCreated_ThenQuantitiesRequestsShippingIsSetToZero

        public void GivenConfirmedOrderItemForGood_WhenShipmentIsCreated_ThenQuantitiesRequestsShippingIsSetToZero()
        {
            this.InstantiateObjects(this.DatabaseSession);

            var inventoryItem = (NonSerializedInventoryItem)this.DatabaseSession.Instantiate(this.good.FinishedGood.InventoryItemsWherePart[0]);
            inventoryItem.AddInventoryItemVariance(new InventoryItemVarianceBuilder(this.DatabaseSession).WithQuantity(110).WithReason(new VarianceReasons(this.DatabaseSession).Unknown).Build());

            this.DatabaseSession.Derive(true);

            var item = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(this.good)
                .WithQuantityOrdered(100)
                .WithActualUnitPrice(5)
                .Build();

            this.order.AddSalesOrderItem(item);

            this.DatabaseSession.Derive(true);

            this.order.Confirm();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(100, item.QuantityOrdered);
            Assert.AreEqual(0, item.QuantityPicked);
            Assert.AreEqual(0, item.QuantityShipped);
            Assert.AreEqual(100, item.QuantityPendingShipment);
            Assert.AreEqual(100, item.QuantityReserved);
            Assert.AreEqual(0, item.QuantityShortFalled);
            Assert.AreEqual(0, item.QuantityRequestsShipping);
            Assert.AreEqual(100, item.ReservedFromInventoryItem.QuantityCommittedOut);
            Assert.AreEqual(10, item.ReservedFromInventoryItem.AvailableToPromise);
            Assert.AreEqual(110, item.ReservedFromInventoryItem.QuantityOnHand);

            Assert.AreEqual(100, item.OrderShipmentsWhereSalesOrderItem[0].Quantity);
        }
开发者ID:Allors,项目名称:apps,代码行数:36,代码来源:SalesOrderItemTests.cs


注:本文中的SalesOrderItemBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。