Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        public void Post(string userId, [FromBody] IngredientDto ingredient)
        {
            IDataAccessObject dao = daoFactory.GetDao();

            dao.AddShopListItem(userId, ingredient);
        }