Пример #1
0
 public void Items_Count_Should_Be_0_When_10_Items_Adjusted_To_Negative_10() {
     ShoppingCart cart = new ShoppingCart("TEST");
     Product p = new Product("SKU");
     cart.AddItem(p,10);
     cart.AdjustQuantity(p, -10);
     Assert.Equal(0, cart.Items.Count);
 }
Пример #2
0
        public void SubTotal_Should_Be_100_When_2_Items_of_Price_5_Adjusted_to_20() {
            ShoppingCart cart = new ShoppingCart("TEST");
            Product p = new Product("SKU");
            p.BasePrice = 5;
            cart.AddItem(p, 1);
            cart.AddItem(p, 1);
            Assert.Equal(10, cart.SubTotal);

            cart.AdjustQuantity(p, 20);
            Assert.Equal(100, cart.SubTotal);

        }
Пример #3
0
 public void Cart_Item_Quantity_Should_Adjust_To_10() {
     ShoppingCart cart = new ShoppingCart("TEST");
     Product p = new Product("SKU");
     cart.AddItem(p);
     cart.AdjustQuantity(p, 10);
     Assert.Equal(10, cart.TotalItems);
 }
Пример #4
0
        public void ItemLastAdded_Should_Be_Sku2_When_SKu1_Sku2_Added_In_Sequence_Regardless_Of_Adjustments() {
            ShoppingCart cart = new ShoppingCart("TEST");
            Product p = new Product("SKU1");
            Product p2 = new Product("SKU2");
            cart.AddItem(p, 1, DateTime.Now.AddSeconds(-1));
            cart.AddItem(p2, 1, DateTime.Now.AddSeconds(1));

            cart.AdjustQuantity(p, 10);

            Assert.Equal("SKU2", cart.ItemLastAdded.Product.SKU);

        }