本文整理汇总了C#中Order.AddLine方法的典型用法代码示例。如果您正苦于以下问题:C# Order.AddLine方法的具体用法?C# Order.AddLine怎么用?C# Order.AddLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Order
的用法示例。
在下文中一共展示了Order.AddLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextReceiptMultiLine
public void TextReceiptMultiLine()
{
var order = new Order("Rolling Thunder Cycles");
order.AddLine(new Line(Defy, 1));
order.AddLine(new Line(Elite, 1));
Assert.AreEqual(TextResultStatementMultiLine, order.CreateReceipt(Receipt.Text));
}
示例2: Invoice_GenerateInvoice_Success
public void Invoice_GenerateInvoice_Success()
{
var order = new Order(companyName, 0.08m);
order.AddLine(new Line(roadBike, 19, new List<Discount> { twentyItemDiscount }));
order.AddLine(new Line(mountainBike, 2));
order.AddLine(new Line(bmxBike, 5, new List<Discount> { twoHundredDollarDiscount }));
var invoice = order.GenerateInvoice();
Console.Write(invoice);
}
示例3: HtmlReceiptOneDefy
public void HtmlReceiptOneDefy()
{
string HtmlResultStatementOneDefy = @"<html><body><h1>Order Receipt for Anywhere Bike Shop</h1><ul><li>1 x Giant Defy 1 = $1,000.00</li></ul><h3>Sub-Total: $1,000.00</h3><h3>Tax: $72.50</h3><h2>Total: $1,072.50</h2></body></html>";
var order = new Order("Anywhere Bike Shop");
order.AddLine(new Line(Data.Bikes.Defy, 1));
Assert.AreEqual(HtmlResultStatementOneDefy, order.HtmlReceipt().Replace(Environment.NewLine, ""));
}
示例4: Total_should_return_sum_of_order_line_totals
public void Total_should_return_sum_of_order_line_totals()
{
var price1 = new Money(3.40M);
var price2 = new Money(6.23M);
var price3 = new Money(10.44M);
var order = new Order();
order.AddLine("line1", 2, price1, "", 1, "");
order.AddLine("line2", 1, price2, "", 1, "");
order.AddLine("line3", 3, price3, "", 1, "");
order.AddLine("line4", 2, price1, "", 1, "");
var expectedTotal = (2*price1) + (1*price2) + (3*price3) + (2*price1);
order.Total.ShouldEqual(expectedTotal);
}
示例5: HtmlReceiptOneElite
public void HtmlReceiptOneElite()
{
string HtmlResultStatementOneElite = @"<html><body><h1>Order Receipt for Anywhere Bike Shop</h1><ul><li>1 x Specialized Venge Elite = $2,000.00</li></ul><h3>Sub-Total: $2,000.00</h3><h3>Tax: $145.00</h3><h2>Total: $2,145.00</h2></body></html>";
var order = new Order("Anywhere Bike Shop");
order.AddLine(new Line(Data.Bikes.Elite, 1));
Assert.AreEqual(HtmlResultStatementOneElite, order.HtmlReceipt().Replace(Environment.NewLine, ""));
}
示例6: ReceiptOneDefy
public void ReceiptOneDefy()
{
string ResultStatementOneDefy = @"Order Receipt for Anywhere Bike Shop 1 x Giant Defy 1 = $1,000.00 Sub-Total: $1,000.00 Tax: $72.50 Total: $1,072.50";
var order = new Order("Anywhere Bike Shop");
order.AddLine(new Line(Data.Bikes.Defy, 1));
Assert.AreEqual(ResultStatementOneDefy, order.Receipt().Replace(Environment.NewLine, " "));
}
示例7: ReceiptOneDuraAce
public void ReceiptOneDuraAce()
{
string ResultStatementOneDuraAce = @"Order Receipt for Anywhere Bike Shop 1 x Specialized S-Works Venge Dura-Ace = $5,000.00 Sub-Total: $5,000.00 Tax: $362.50 Total: $5,362.50";
var order = new Order("Anywhere Bike Shop");
order.AddLine(new Line(Data.Bikes.DuraAce, 1));
Assert.AreEqual(ResultStatementOneDuraAce, order.Receipt().Replace(Environment.NewLine, " "));
}
示例8: ReceiptOneElite
public void ReceiptOneElite()
{
string ResultStatementOneElite = @"Order Receipt for Anywhere Bike Shop 1 x Specialized Venge Elite = $2,000.00 Sub-Total: $2,000.00 Tax: $145.00 Total: $2,145.00";
var order = new Order("Anywhere Bike Shop");
order.AddLine(new Line(Data.Bikes.Elite, 1));
Assert.AreEqual(ResultStatementOneElite, order.Receipt().Replace(Environment.NewLine, " "));
}
示例9: HtmlReceiptOneDefy
public void HtmlReceiptOneDefy()
{
var order = new Order("Anywhere Bike Shop");
order.AddLine(new Line(Defy, 1));
OrderFactory.RecalculateOrder(order);
string result = ReceiptFactory.CreateHtmlReceipt(order);
Assert.AreEqual(HtmlResultStatementOneDefy, result);
}
示例10: GivenAnOrderDiscount_WhenApplyToOrder_ThenShouldReturnOrderSubTotalTimesPercentage
public void GivenAnOrderDiscount_WhenApplyToOrder_ThenShouldReturnOrderSubTotalTimesPercentage()
{
var sut = new OrderDiscount("d", 1);
var order = new Order(string.Empty);
order.AddLine(new Line(new Bike(string.Empty, string.Empty, 1), 1));
Assert.AreEqual(order.CalculateSubTotal() * sut.Percentage, sut.Apply(order));
}
示例11: 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);
}
示例12: 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);
}
示例13: 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);
}
示例14: Order_GenerateReceiptWithTenItemDiscountWithLessThan10Items_Success
public void Order_GenerateReceiptWithTenItemDiscountWithLessThan10Items_Success()
{
var order = new Order(companyName, 0.08m);
order.AddLine(new Line(roadBike, 9, 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);
}
示例15: AddOrderLinesFromBasket
private static void AddOrderLinesFromBasket(Order order, Basket basket)
{
foreach (var basketItem in basket.BasketItems)
{
var productName = basketItem.Size.Product.Name + (basketItem.Size.Name == "-" ? "" : " - " + basketItem.Size.Name);
order.AddLine(
productName,
basketItem.Quantity,
basketItem.Size.Product.Price,
basketItem.Size.Product.UrlName,
basketItem.Size.Product.Id,
basketItem.Size.Name);
}
}