public void AddMultipleSameItem_UpdatesLineCount_Success()
        {
            var basket = new ShoppingBasket();
            var bread1 = TestMockProductsLineItems.BreadItem();
            var bread2 = TestMockProductsLineItems.BreadItem();

            basket.AddProduct(bread1.Product, 1);
            basket.AddProduct(bread2.Product, 1);

            Assert.True(basket.Products[0].Quantity == 2 && basket.Products[0].Product.Id == 1);
            Assert.True(basket.GetTotal() == 2.00m);
            Assert.True(basket.Products.Count == 1);
        }
        public void DeleteLineItem_Success()
        {
            var basket = new ShoppingBasket();
            var bread1 = TestMockProductsLineItems.BreadItem();
            var bread2 = TestMockProductsLineItems.BreadItem();

            basket.AddProduct(bread1.Product, 1);
            basket.AddProduct(bread2.Product, 1);

            _output.WriteLine($"Total before delete: {basket.Products.Count}");
            basket.DeleteProductLine(1);

            _output.WriteLine($"Total after delete: {basket.Products.Count}");
            Assert.True(basket.Products.Count == 0);
        }
        public static IEnumerable <object[]> DiscountedProductsGetHalfPrice()
        {
            var products = new List <IProductLineItem> {
                TestMockProductsLineItems.ButterItem(), TestMockProductsLineItems.ButterItem(), TestMockProductsLineItems.BreadItem(), TestMockProductsLineItems.BreadItem()
            };
            var products2 = new List <IProductLineItem> {
                TestMockProductsLineItems.ButterItem(), TestMockProductsLineItems.ButterItem(), TestMockProductsLineItems.ButterItem(), TestMockProductsLineItems.ButterItem(),
                TestMockProductsLineItems.BreadItem(), TestMockProductsLineItems.BreadItem()
            };
            var products3 = new List <IProductLineItem> {
                TestMockProductsLineItems.ButterItem(), TestMockProductsLineItems.ButterItem(), TestMockProductsLineItems.ButterItem(), TestMockProductsLineItems.ButterItem(),
                TestMockProductsLineItems.BreadItem(), TestMockProductsLineItems.BreadItem(), TestMockProductsLineItems.BreadItem()
            };

            yield return(new object[] { products, 3.10m });

            yield return(new object[] { products2, 4.20m });

            yield return(new object[] { products3, 5.20m });
        }
        public static IEnumerable <object[]> Products()
        {
            var products = new List <Product> {
                TestMockProductsLineItems.BreadItem().Product
            };
            var products2 = new List <Product> {
                TestMockProductsLineItems.BreadItem().Product, TestMockProductsLineItems.BreadItem().Product
            };
            var products3 = new List <Product> {
                TestMockProductsLineItems.BreadItem().Product, TestMockProductsLineItems.ButterItem().Product, TestMockProductsLineItems.MilkItem().Product
            };
            var products4 = new List <Product> {
                TestMockProductsLineItems.BreadItem().Product, TestMockProductsLineItems.ButterItem().Product, TestMockProductsLineItems.MilkItem().Product, TestMockProductsLineItems.MilkItem().Product
            };

            yield return(new object[] { products, 1, 1.00m });

            yield return(new object[] { products2, 1, 2.00m }); // Line items should still be 1 but total 2

            yield return(new object[] { products3, 3, 2.95m });

            yield return(new object[] { products4, 3, 4.10m });
        }