Beispiel #1
0
        public void SalesTaxTotalShouldBeCorrect()
        {
            Order     order = new Order();
            MockDrink drink = new MockDrink();

            drink.Price = 10;
            order.Add(drink);
            Assert.Equal(1, order.SalesTaxCost);
        }
Beispiel #2
0
        public void RemoveDrinkFromOrderRemovesFromItems()
        {
            Order     o  = new Order();
            MockDrink md = new MockDrink();

            o.Add(md);
            o.Remove(md);
            Assert.Empty(o.Items);
        }
Beispiel #3
0
        public void SubtotalCostShouldNotBeNegative()
        {
            Order     order = new Order();
            MockDrink md    = new MockDrink();
            MockSide  ms    = new MockSide();

            order.Add(md);
            order.Add(ms);
            Assert.Equal <double>(10, order.SubtotalCost);
        }
Beispiel #4
0
        public void AddDrinkToOrderAddsToItems()
        {
            Order     o  = new Order();
            MockDrink md = new MockDrink();

            o.Add(md);
            Assert.Collection <IOrderItem>(o.Items,
                                           item =>
            {
                Assert.Equal(md, item);
            });
        }
Beispiel #5
0
        public void SubTotalCostShouldBeCorrect()
        {
            Order      order = new Order();
            MockDrink  md    = new MockDrink(5);
            MockEntree me    = new MockEntree(2.5);
            MockSide   ms    = new MockSide(2.5);

            order.Add(md);
            order.Add(me);
            order.Add(ms);
            Assert.Equal <double>(10, order.SubtotalCost);
        }
Beispiel #6
0
        public void SubtotalCostIsCorrect()
        {
            Order      order  = new Order();
            MockEntree entree = new MockEntree(2);
            MockSide   side   = new MockSide(2);
            MockDrink  drink  = new MockDrink(2);

            order.Add(entree);
            order.Add(side);
            order.Add(drink);
            Assert.Equal <double>(6, order.SubtotalCost);
        }
Beispiel #7
0
        public void SubtotalCostIsSumOfAllItemPrices()
        {
            Order      o  = new Order();
            MockEntree me = new MockEntree();
            MockSide   ms = new MockSide();
            MockDrink  md = new MockDrink();

            o.Add(me);
            o.Add(ms);
            o.Add(md);
            Assert.Equal(6.00, o.SubtotalCost);
        }
Beispiel #8
0
        public void SubTotalShouldNeverBeNegative()
        {
            Order      order = new Order();
            MockDrink  md    = new MockDrink(-69);
            MockEntree me    = new MockEntree(-5);
            MockSide   ms    = new MockSide(1);

            order.Add(md);
            order.Add(me);
            order.Add(ms);
            Assert.Equal <double>(0, order.SubtotalCost);
        }
Beispiel #9
0
        public void NegativeTotalCostShouldBeZero()
        {
            MockEntree me = new MockEntree(5.50);
            MockSide   ms = new MockSide(-3.00);
            MockDrink  md = new MockDrink(-2.50);
            Order      o  = new Order();

            o.Add(me);
            o.Add(ms);
            o.Add(md);

            Assert.Equal <double>(0, o.SubtotalCost);
        }
Beispiel #10
0
        public void TotalCostTest()
        {
            MockEntree me = new MockEntree(5.50);
            MockSide   ms = new MockSide(3.00);
            MockDrink  md = new MockDrink(2.50);
            Order      o  = new Order();

            o.Add(me);
            o.Add(ms);
            o.Add(md);

            Assert.Equal <double>(11.98, o.TotalCost);
        }
Beispiel #11
0
        public void TotalCostIsCorrect()
        {
            Order      order  = new Order();
            MockEntree entree = new MockEntree(2);
            MockSide   side   = new MockSide(2);
            MockDrink  drink  = new MockDrink(2);

            order.Add(entree);
            order.Add(side);
            order.Add(drink);
            order.SalesTaxRate = .065;
            Assert.Equal <double>(6.39, order.TotalCost);
        }
Beispiel #12
0
        public void SalesTaxCostShouldBeCorrect()
        {
            Order      order = new Order();
            MockDrink  md    = new MockDrink(8.5);
            MockEntree me    = new MockEntree(0.5);
            MockSide   ms    = new MockSide(1);

            order.Add(md);
            order.Add(me);
            order.Add(ms);
            double salesTaxCost = order.SalesTaxRate * 10;

            Assert.Equal <double>(salesTaxCost, order.SalesTaxCost);
        }
Beispiel #13
0
        public void TotalCostShouldBeCorrect()
        {
            Order      order  = new Order();
            MockDrink  drink  = new MockDrink();
            MockEntree entree = new MockEntree();
            MockSide   side   = new MockSide();

            entree.Price = 15;
            side.Price   = 5;
            drink.Price  = 10;
            order.Add(drink);
            order.Add(entree);
            order.Add(side);
            Assert.Equal(33, order.TotalCost);
        }
Beispiel #14
0
        public void TotalCostShouldBeCorrect()
        {
            Order      order = new Order();
            MockDrink  md    = new MockDrink(8);
            MockEntree me    = new MockEntree(1);
            MockSide   ms    = new MockSide(1);

            order.Add(md);
            order.Add(me);
            order.Add(ms);
            double salesTaxCost = order.SalesTaxRate * 10;
            double total        = salesTaxCost + 10;

            Assert.Equal <double>(total, order.TotalCost);
        }
Beispiel #15
0
        public void TotalCostShouldMatch(double ep, double sp, double dp, double t)
        {
            MockDrink  d = new MockDrink();
            MockEntree e = new MockEntree();
            MockSide   s = new MockSide();
            Order      o = new Order();

            d.Price = 2;
            e.Price = 5;
            s.Price = 3;
            o.Add(d);
            o.Add(e);
            o.Add(s);

            Assert.Equal <double>((ep + sp + dp) + ((ep + sp + dp) * t), o.SubtotalCost);
        }
Beispiel #16
0
        public void OrderCostIsCalculatedCorrectly(double tax,
                                                   double entreePrice,
                                                   double drinkPrice,
                                                   double sidePrice,
                                                   double exCost)
        {
            MockEntree entree = new MockEntree(entreePrice);
            MockDrink  drink  = new MockDrink(drinkPrice);
            MockSide   side   = new MockSide(sidePrice);
            Order      odr    = new Order(tax);

            odr.Items.Add(entree);
            odr.Items.Add(drink);
            odr.Items.Add(side);
            Assert.Equal(exCost, odr.TotalCost);
        }
Beispiel #17
0
        public void NegativeSubtotalSouldntBeNegative(double ep, double sp, double dp, double t)
        {
            MockDrink  d = new MockDrink();
            MockEntree e = new MockEntree();
            MockSide   s = new MockSide();
            Order      o = new Order();

            d.Price = 2;
            e.Price = -10;
            s.Price = 3;
            o.Add(d);
            o.Add(e);
            o.Add(s);

            Assert.Equal <double>(0, o.SubtotalCost);
        }