Ejemplo n.º 1
0
        public void GetTotalPriceTest_GroupTwo()
        {
            List<AbstractItem> items = new List<AbstractItem>();
            items.Add(new Item(Category.FOOD, true, 10.00m));
            items.Add(new Item(Category.OTHERS, true, 47.50m));

            List<AbstractItem> itemList = new TaxedRule().Apply(items);
            decimal totalPrice = 0.0m;
            decimal salesTaxes = 0.0m;
            decimal totalPriceResult = 65.15m;
            decimal salesTaxesResult = 7.65m;
            HelpClass.GetTotalPrice(itemList, ref totalPrice, ref salesTaxes);
            Assert.AreEqual(totalPriceResult, totalPrice);
            Assert.AreEqual(salesTaxesResult, salesTaxesResult);
        }
Ejemplo n.º 2
0
        public void GetTotalPriceTest_GroupOne()
        {
            List<AbstractItem> items = new List<AbstractItem>();
            items.Add(new Item(Category.BOOK, false, 12.49m));
            items.Add(new Item(Category.OTHERS, false, 14.99m));
            items.Add(new Item(Category.FOOD, false, 0.85m));

            List<AbstractItem> itemList = new TaxedRule().Apply(items);
            decimal totalPrice = 0.0m;
            decimal salesTaxes = 0.0m;
            decimal totalPriceResult = 29.83m;
            decimal salesTaxesResult = 1.50m;
            HelpClass.GetTotalPrice(itemList, ref totalPrice, ref salesTaxes);
            Assert.AreEqual(totalPriceResult, totalPrice);
            Assert.AreEqual(salesTaxesResult, salesTaxesResult);
        }
Ejemplo n.º 3
0
        public void GetTotalPriceTest_GrouThree()
        {
            List<AbstractItem> items = new List<AbstractItem>();
            items.Add(new Item(Category.OTHERS, true, 27.99m));
            items.Add(new Item(Category.OTHERS, false, 18.99m));
            items.Add(new Item(Category.MEDICAL, false, 9.75m));
            items.Add(new Item(Category.FOOD, true, 11.25m));

            List<AbstractItem> itemList = new TaxedRule().Apply(items);
            decimal totalPrice = 0.0m;
            decimal salesTaxes = 0.0m;
            decimal totalPriceResult = 74.68m;
            decimal salesTaxesResult = 6.70m;
            HelpClass.GetTotalPrice(itemList, ref totalPrice, ref salesTaxes);
            Assert.AreEqual(totalPriceResult, totalPrice);
            Assert.AreEqual(salesTaxesResult, salesTaxesResult);
        }
Ejemplo n.º 4
0
 public void SetUp()
 {
     rule = new TaxedRule();
 }