// GET: api/ShopList/TestUser public List <IngredientDto> Get(string userId) { IDataAccessObject dao = daoFactory.GetDao(); var result = dao.GetShopList(userId); return(result); }
public void AddShopListItem() { // Arrage IDataAccessObjectFactory factory = DatabaseFactory.GetInstance(); IDataAccessObject database = factory.GetDao(); var item = new IngredientDto() { Amount = 3, IngredientName = "Test", Unit = "Test" }; // Act database.AddShopListItem("db1500c7-f616-45d3-8069-14a9f264f2fa", item); // Assert var list = database.GetShopList("db1500c7-f616-45d3-8069-14a9f264f2fa"); foreach (var i in list) { if (i.IngredientName == "Test") { database.DeleteRecipe("Test"); Assert.Pass(); } } Assert.Fail(); }
public void DeleteShopListItem() { // Arrange IDataAccessObjectFactory factory = DatabaseFactory.GetInstance(); IDataAccessObject database = factory.GetDao(); database.AddShopListItem("db1500c7-f616-45d3-8069-14a9f264f2fa", new IngredientDto() { IngredientName = "toDelete" }); // Act database.DeleteShopListItem("db1500c7-f616-45d3-8069-14a9f264f2fa", "toDelete"); // Assert var list = database.GetShopList("db1500c7-f616-45d3-8069-14a9f264f2fa"); foreach (var i in list) { if (i.IngredientName == "toDelete") { Assert.Fail(); } } Assert.Pass(); }
public void GetShopList() { IDataAccessObjectFactory factory = DatabaseFactory.GetInstance(); IDataAccessObject database = factory.GetDao(); var result = database.GetShopList("Test"); }