本文整理汇总了C#中Order.GenerateReceipt方法的典型用法代码示例。如果您正苦于以下问题:C# Order.GenerateReceipt方法的具体用法?C# Order.GenerateReceipt怎么用?C# Order.GenerateReceipt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Order
的用法示例。
在下文中一共展示了Order.GenerateReceipt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Order_GenerateReceiptWith10PercentDiscount_Success
public void Order_GenerateReceiptWith10PercentDiscount_Success()
{
var order = new Order(companyName, 0.08m);
order.AddLine(new Line(roadBike, 10, new List<Discount> { tenPercentDiscount }));
var receipt = order.GenerateReceipt();
WriteReceiptToConsole(receipt);
Assert.AreEqual(9720m, receipt.Total);
}
示例2: Order_GenerateReceiptWithMultipleDiscounts_Success
public void Order_GenerateReceiptWithMultipleDiscounts_Success()
{
var order = new Order(companyName, 0.08m);
order.AddLine(new Line(roadBike, 10, new List<Discount> { twoHundredDollarDiscount, tenPercentDiscount }));
var receipt = order.GenerateReceipt();
WriteReceiptToConsole(receipt);
Assert.AreEqual(9525.6m, receipt.Total);
}
示例3: Order_GenerateReceiptWithFiveItemDiscountWithLessThan5Items_Success
public void Order_GenerateReceiptWithFiveItemDiscountWithLessThan5Items_Success()
{
var order = new Order(companyName, 0.08m);
order.AddLine(new Line(roadBike, 4, new List<Discount> { fiveItemDiscount }));
var receipt = order.GenerateReceipt();
WriteReceiptToConsole(receipt);
Assert.AreEqual(4320m, receipt.Total);
}
示例4: Order_GenerateReceiptWithTenItemDiscount_Success
public void Order_GenerateReceiptWithTenItemDiscount_Success()
{
var order = new Order(companyName, 0.08m);
order.AddLine(new Line(roadBike, 10, new List<Discount> { tenItemDiscount }));
order.AddLine(new Line(mountainBike, 2));
order.AddLine(new Line(bmxBike, 5, new List<Discount> { twoHundredDollarDiscount }));
var receipt = order.GenerateReceipt();
WriteReceiptToConsole(receipt);
Assert.AreEqual(15436.44m, receipt.Total);
}
示例5: Order_GenerateReceipt_Successful
public void Order_GenerateReceipt_Successful()
{
var order = new Order(companyName, 0.08m);
order.AddLine(new Line(roadBike, 10));
var receipt = order.GenerateReceipt();
WriteReceiptToConsole(receipt);
Assert.NotNull(receipt);
Assert.AreEqual(10800m, receipt.Total, "Expecting total to equal $10800");
}