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