Exemplo n.º 1
0
        public bool AddLineItem(string pLineItem)
        {
            var oLineItem = new LineItem(pLineItem);
            mLineItems.Add(oLineItem);

            IncrementTotalSalesTax(oLineItem);
            return true;
        }
        public void CalculateSalesTaxTest()
        {
            var oSingleCountLineItem = new LineItem(SINGLE_COUNT_DOMESTIC_LINE_ITEM_AS_INPUT_STRING);
            Assert.AreEqual(new decimal(0.50), oSingleCountLineItem.Tax.Amount);

            var oMultiCountLineItem = new LineItem(MULTIPLE_COUNT_DOMESTIC_LINE_ITEM_AS_INPUT_STRING);
            Assert.AreEqual(new decimal(1.55), oMultiCountLineItem.Tax.Amount);
        }
        public void ConvertToLineItemTest()
        {
            var oSingleCountLineItem = new LineItem(SINGLE_COUNT_LINE_ITEM_AS_INPUT_STRING);
            Assert.AreEqual(1, oSingleCountLineItem.Count);
            Assert.AreEqual("imported box of chocolates", oSingleCountLineItem.Description);
            Assert.AreEqual(new decimal(10.85), oSingleCountLineItem.Price.Amount);

            var oMultiCountLineItem = new LineItem(MULTIPLE_COUNT_LINE_ITEM_AS_INPUT_STRING);
            Assert.AreEqual(14, oMultiCountLineItem.Count);
            Assert.AreEqual("imported box of chocolates", oMultiCountLineItem.Description);
            Assert.AreEqual(new decimal(14 * 10.85), oMultiCountLineItem.Price.Amount);
        }
Exemplo n.º 4
0
 public void IncrementTotalSalesTax(LineItem pLineItem)
 {
     mSalesTax.Amount += pLineItem.Tax.Amount;
 }
        public void ToStringTest()
        {
            var oSingleCountLineItem = new LineItem(SINGLE_COUNT_LINE_ITEM_AS_INPUT_STRING);
            Assert.AreEqual("1 imported box of chocolates : 11.40", oSingleCountLineItem.ToString());

            var oMultiCountLineItem = new LineItem(MULTIPLE_COUNT_LINE_ITEM_AS_INPUT_STRING);
            Assert.AreEqual("14 imported box of chocolates : 159.50", oMultiCountLineItem.ToString());
        }
Exemplo n.º 6
0
 public OrderTest()
 {
     mLineItem = new LineItem(LINE_ITEM_AS_INPUT_STRING);
 }