Beispiel #1
0
 public static string Print(OrderLine orderLine)
 {
     return string.Format("{0}{1}{2}",
                          orderLine.GetDescription(OrderLineDescriber),
                          PrinterConst.COLON,
                          orderLine.AfterTaxAmount().ToString(PrinterConst.DECIMAL_FORMAT));
 }
Beispiel #2
0
        public void Can_Calculate_PreTaxAmount()
        {
            Product stubProduct = ProductStubifier.CreateStubProduct(11.50m);
            _orderLineSut = new OrderLine(stubProduct) {Quantity = 10};

            decimal preTaxAmount = _orderLineSut.PreTaxAmount();

            Assert.AreEqual(115.0m, preTaxAmount);
        }
Beispiel #3
0
        private void CreateSut(bool withMockService)
        {
            _orderLineSut = new OrderLine(ProductStubifier.CreateStubProduct());

            if (!withMockService)
                return;

            _mockTaxService = new Mock<ITaxService>();
            _orderLineSut.TaxService = _mockTaxService.Object;
        }
Beispiel #4
0
        public string Describe(OrderLine orderLine)
        {
            var sb = new StringBuilder();

            OutputQuantity(sb, orderLine);
            OutputSaleUnit(sb, orderLine.Product);
            OutputImportedInfo(sb, orderLine);
            OutputPurchaseUnit(sb, orderLine.Product);
            OutputProductName(sb, orderLine);

            return sb.ToString();
        }
Beispiel #5
0
 private static void OutputQuantity(StringBuilder sb, OrderLine orderLine)
 {
     sb.Append(orderLine.Quantity).Append(Space);
 }
Beispiel #6
0
 private static void OutputProductName(StringBuilder sb, OrderLine orderLine)
 {
     sb.Append(orderLine.Product.Name);
 }
Beispiel #7
0
 private static void OutputImportedInfo(StringBuilder sb, OrderLine orderLine)
 {
     if (orderLine.IsImported)
         sb.Append(PrinterConst.IMPORTED).Append(Space);
 }