public void TestRemoveListItem()
            {
                var item      = db.LAListItems.Find(8);
                var itemCount = db.LAListItems.ToList().Count;

                Assert.IsNotNull(item);

                var result = listQueries.DeleteItemFromList(item.ID, 3);

                Assert.AreEqual(true, result);
                Assert.AreEqual(true, itemCount > db.LAListItems.ToList().Count);
            }
        public HttpStatusCode DeleteItemFromList(int itemId, int listId)
        {
            if (listQueries.DeleteItemFromList(itemId, listId))
            {
                return(HttpStatusCode.OK);
            }

            return(HttpStatusCode.InternalServerError);
        }
Beispiel #3
0
        public void TestRemoveItemBadId()
        {
            LAList testList  = ListQueries.GetList(1);
            var    itemCount = testList.LAListItems.Count;

            var result = ListQueries.DeleteItemFromList(-99);

            testList = ListQueries.GetList(1);
            Assert.AreEqual(-1, result);
            Assert.AreEqual(itemCount, testList.LAListItems.Count);
        }
Beispiel #4
0
        public void TestRemoveListItem()
        {
            LAList testList = ListQueries.GetList(1);

            Assert.IsNotNull(testList);

            Assert.IsTrue(ListQueries.AddItemToList(new LAListItem()
            {
                Description = "Bread", ListID = 1
            }));

            testList = ListQueries.GetList(1);
            Assert.IsNotNull(testList);
            Assert.AreEqual(5, testList.LAListItems.Count);

            var result = ListQueries.DeleteItemFromList(testList.LAListItems[4].ID);

            testList = ListQueries.GetList(1);
            Assert.IsNotNull(testList);

            Assert.AreEqual(1, result);
            Assert.AreEqual(4, testList.LAListItems.Count);
        }