public void Should_Clear_All_Grocery()
        {
            var repo = new GroceryRepository(_connection);

            repo.ClearGrocery();

            var groceries = repo.GetGroceries();

            Assert.IsNotNull(groceries);
            Assert.IsTrue(!groceries.Any());
        }
        public void Should_Add_Products()
        {
            var repo = new GroceryRepository(_connection);

            const string name = "blabla";

            repo.AddProduct(name, false);

            var product = repo.GetProduct(name);

            Assert.IsNotNull(product);
            Assert.IsTrue(product.Name == name);

            repo.DeleteProduct(product.Id);
        }
        public void Should_Add_Products_Add_To_Groceries()
        {
            var repo = new GroceryRepository(_connection);

            const string name = "blabla";

            repo.AddProduct(name, true);

            var product = repo.GetProduct(name);
            Assert.IsNotNull(product);
            Assert.IsTrue(product.Name == name);

            var grocery = repo.GetGroceryByProductId(product.Id);
            Assert.IsNotNull(grocery);

            repo.DeleteGrocery(grocery.ProductId);
            repo.DeleteProduct(product.Id);
        }
        public void Should_Add_Grocery()
        {
            var repo = new GroceryRepository(_connection);

            const string name = "blabla";
            repo.AddProduct(name, false);
            var product = repo.GetProduct(name);

            repo.AddGrocery(product.Id);

            var grocery = repo.GetGroceryByProductId(product.Id);

            Assert.IsNotNull(grocery);
            Assert.IsTrue(grocery.ProductId == product.Id);

            repo.DeleteGrocery(product.Id);
            repo.DeleteProduct(product.Id);
        }
        public void Should_return_Products_Not_In_Groceries()
        {
            var repo = new GroceryRepository(_connection);

            const string name = "blabla";

            repo.AddProduct(name, false);

            var prods = repo.GetProducts().ToList();

            Assert.IsNotNull(prods);
            Assert.IsTrue(prods.Any());

            var product = repo.GetProduct(name);
            repo.DeleteProduct(product.Id);
        }
        public void Should_Return_Grocery_From_ProductId()
        {
            var repo = new GroceryRepository(_connection);

            const string name = "blabla";
            repo.AddProduct(name, false);
            var product = repo.GetProduct(name);
            repo.AddGrocery(product.Id);

            var groceries = repo.GetGroceries().ToList();
            Assert.IsTrue(groceries.Any());

            var groceryProduct = groceries.FirstOrDefault();
            Assert.IsNotNull(groceryProduct);

            var grocery = repo.GetGroceryByProductId(groceryProduct.ProductId);

            Assert.IsNotNull(grocery);
            Assert.IsTrue(grocery.ProductId == groceryProduct.ProductId);

            repo.DeleteGrocery(product.Id);
            repo.DeleteProduct(product.Id);
        }