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


C# SalesOrderItemBuilder.Confirm方法代码示例

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


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

示例1: GivenOrderItemForGood1WithRequiredMarkupPercentage_WhenDerivingPrices_ThenCalculateActualUnitPrice

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

            var item1 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(this.good).WithQuantityOrdered(3).WithRequiredMarkupPercentage(45).Build();
            this.order.AddSalesOrderItem(item1);
            item1.Confirm();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(10.15M, item1.ActualUnitPrice);
            Assert.AreEqual(10M, item1.UnitBasePrice);
            Assert.AreEqual(0, item1.UnitDiscount);
            Assert.AreEqual(0, item1.UnitSurcharge);
            Assert.AreEqual(10.15M, item1.CalculatedUnitPrice);
            Assert.AreEqual(2.13, item1.UnitVat);
            Assert.AreEqual(30.45M, item1.TotalBasePrice);
            Assert.AreEqual(0, item1.TotalDiscount);
            Assert.AreEqual(0, item1.TotalSurcharge);
            Assert.AreEqual(30.45M, item1.TotalExVat);
            Assert.AreEqual(6.39M, item1.TotalVat);
            Assert.AreEqual(36.84M, item1.TotalIncVat);
            Assert.AreEqual(7, item1.UnitPurchasePrice);

            Assert.AreEqual(decimal.Round(((item1.UnitBasePrice / this.goodPurchasePrice.Price) - 1) * 100, 2), item1.InitialMarkupPercentage);
            Assert.AreEqual(decimal.Round(((item1.CalculatedUnitPrice / this.goodPurchasePrice.Price) - 1) * 100, 2), item1.MaintainedMarkupPercentage);
            Assert.AreEqual(decimal.Round(((item1.UnitBasePrice - this.goodPurchasePrice.Price) / item1.UnitBasePrice) * 100, 2), item1.InitialProfitMargin);
            Assert.AreEqual(decimal.Round(((item1.CalculatedUnitPrice - this.goodPurchasePrice.Price) / item1.CalculatedUnitPrice) * 100, 2), item1.MaintainedProfitMargin);

            Assert.AreEqual(30.45M, this.order.TotalBasePrice);
            Assert.AreEqual(0, this.order.TotalDiscount);
            Assert.AreEqual(0, this.order.TotalSurcharge);
            Assert.AreEqual(30.45M, this.order.TotalExVat);
            Assert.AreEqual(6.39M, this.order.TotalVat);
            Assert.AreEqual(36.84M, this.order.TotalIncVat);
            Assert.AreEqual(10.15M, this.order.TotalListPrice);
            Assert.AreEqual(7, this.order.TotalPurchasePrice);
        }
开发者ID:Allors,项目名称:apps,代码行数:38,代码来源:SalesOrderItemPricingTests.cs


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