Пример #1
0
        public void Webshop_Fail_Checkout_NotEnoughMoney_InsufficientFundsException()
        {
            Basket  b = new Basket();
            Product p = new Product()
            {
                Name  = "Hemtenta",
                Price = 100
            };

            MyWebshop mw = new MyWebshop(b);

            mw.Basket.AddProduct(p, 10);

            Bill bill = new Bill();

            bill.Balance = 500;

            Assert.Throws <InsufficientFundsException>(() => mw.Checkout(bill));
            mw.ResetCart();
            //mw.Basket.RemoveProduct(p, 10);
            Assert.That(mw.Basket.TotalCost, Is.EqualTo(0));
        }
Пример #2
0
        public void Webshop_Checkout_Succeed()
        {
            Basket  b = new Basket();
            Product p = new Product()
            {
                Name  = "Hemtenta",
                Price = 100
            };

            MyWebshop mw = new MyWebshop(b);

            mw.Basket.AddProduct(p, 10);

            Bill bill = new Bill();

            bill.Balance = 1000;

            mw.Checkout(bill);
            mw.ResetCart();
            //mw.Basket.RemoveProduct(p, 10);

            Assert.That(bill.Balance, Is.EqualTo(0));
            Assert.That(mw.Basket.TotalCost, Is.EqualTo(0));
        }
Пример #3
0
        public void Webshop_Fail_NullBasket_NullReferenceException()
        {
            MyWebshop mw;

            Assert.Throws <NullReferenceException>(() => mw = new MyWebshop(null));
        }