/// <summary> /// Creates a concrete Receipt based upon requested type /// </summary> /// <param name="type">The type of the Receipt to create</param> /// <returns>The concrete Receipt</returns> public static IReceipt CreateReceipt(Receipt type) { IReceipt receipt; switch (type) { case Receipt.Text: receipt = new TextReceipt(); break; case Receipt.Html: receipt = new HtmlReceipt(); break; default: receipt = null; break; } return receipt; }
/// <summary> /// Creates a concrete Receipt based upon requested type /// </summary> /// <param name="type">The type of the Receipt to create</param> /// <returns>The concrete Receipt</returns> public static IReceipt CreateReceipt(Receipt type) { IReceipt receipt; switch (type) { case Receipt.Text: receipt = new TextReceipt(); break; case Receipt.Html: receipt = new HtmlReceipt(); break; default: receipt = null; break; } return(receipt); }
public void HtmlReceiptFiveS5Discount() { var company = "Anywhere Bike Shop"; var order = new Order(company); var quantity = 5; var testLine = new Line(S5, quantity); order.AddLine(testLine); var checkReceiptAgainst = new HtmlReceipt(new ReceiptData(company, "$32,000.00", new TupleList<Line, string> { { testLine, "$32,000.00" } }, "$2,320.00", "$34,320.00")).TransformText(); Assert.AreEqual(checkReceiptAgainst, order.Receipt(Order.Format.HTML)); }
public void HtmlReceiptOneDuraAce() { var company = "Anywhere Bike Shop"; var order = new Order(company); var quantity = 1; var testLine = new Line(DuraAce, quantity); order.AddLine(testLine); var checkReceiptAgainst = new HtmlReceipt(new ReceiptData(company, "$5,000.00", new TupleList<Line, string> { { testLine, "$5,000.00" } }, "$362.50", "$5,362.50")).TransformText(); Assert.AreEqual(checkReceiptAgainst, order.Receipt(Order.Format.HTML)); }