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_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); }