Exemplo n.º 1
0
        public void SubtotalCostShouldNeverBeNegative()
        {
            Order      order  = new Order();
            MockEntree entree = new MockEntree(-10);

            order.Add(entree);
            Assert.Equal <double>(0, order.SubtotalCost);
        }
Exemplo n.º 2
0
        public void SubtotalCostShouldBeNegative()
        {
            Order      order = new Order();
            MockEntree me    = new MockEntree();

            order.Add(me);
            Assert.Equal <double>(0, order.SubtotalCost);
        }
Exemplo n.º 3
0
        public void RemoveEntreeFromOrderRemovesFromItems()
        {
            Order      o  = new Order();
            MockEntree me = new MockEntree();

            o.Add(me);
            o.Remove(me);
            Assert.Empty(o.Items);
        }
Exemplo n.º 4
0
        public void SalesTaxCostIsCorrect()
        {
            Order      o  = new Order();
            MockEntree me = new MockEntree();

            o.Add(me);
            o.SalesTaxRate = .03;
            Assert.Equal(0.03 * 1.00, o.SalesTaxCost);
        }
Exemplo n.º 5
0
        public void SubtotalCostShouldNotBeNegative()
        {
            Order      order = new Order();
            MockEntree mock  = new MockEntree();

            mock.Price = -4.5;
            order.Add(mock);
            Assert.Equal(0, order.SubtotalCost);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public void AddEntreeToOrderAddsToItems()
        {
            Order      o  = new Order();
            MockEntree me = new MockEntree();

            o.Add(me);
            Assert.Collection <IOrderItem>(o.Items,
                                           item =>
            {
                Assert.Equal(me, item);
            });
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
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);
        }
Exemplo n.º 18
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);
        }
Exemplo n.º 19
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);
        }