Esempio n. 1
0
        public void DeleteItem(string id)
        {
            var parsedId = int.Parse(id);

            Item item = _itemsEngine.GetItem(parsedId);

            _itemsEngine.DeleteItem(item.Id);
        }
        public void ItemsEngine_GetItem()
        {
            //Arrange: Seeds the Mocked Accessor's list of Items and sets the expected list
            SeedItems();
            var expected = new Item {
                Id            = 2,
                Name          = "Juice",
                GroceryListId = 1
            };


            //Act: Calls the ItemsEngine GetItem() method to return the Item with id = 2
            var result = itemsEngine.GetItem(2);


            //Assert: Checks whether expected and result Item are the same
            Assert.AreEqual(expected, result, $"Item {result.Id} was returned. Item {expected.Id} was expected.");
        }