示例#1
0
        public void TestGetAllLists()
        {
            var lists = ListQueries.GetLists();

            Assert.IsNotNull(lists);
            Assert.AreEqual(2, lists.Count);
        }
示例#2
0
        public void TestAddListToDBNoItems()
        {
            var listName = "Test List 4";

            var lists = new List <LAList>
            {
                new LAList {
                    Name = listName
                }
            };

            ListQueries.AddList(lists[0]);
            var result = ListQueries.GetList(3);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.LAListItems.Count, 0, "Number of list items is not 0");

            var findResult = ListQueries.GetList(3);

            Assert.IsNotNull(findResult);
            Assert.AreEqual <string>("Test List 4", findResult.Name);

            ListQueries.RemoveList(findResult.ID);
            Assert.AreEqual(2, ListQueries.GetLists().Count);
        }
示例#3
0
        public void TestRemoveZeroListID()
        {
            var result = ListQueries.RemoveList(0);

            Assert.AreEqual(false, result);
            Assert.AreEqual(2, ListQueries.GetLists().Count);
        }
示例#4
0
        public void TestAddListItem()
        {
            LAList testList = new LAList()
            {
                Name = "List to Remove"
            };

            ListQueries.AddList(testList);

            Assert.IsNotNull(ListQueries.GetList(testList.ID));
            Assert.AreEqual(0, ListQueries.GetList(testList.ID).LAListItems.Count);

            var newItem = new LAListItem()
            {
                Description = "Test Item",
                Done        = true,
                ListID      = testList.ID
            };

            var result    = ListQueries.AddItemToList(newItem);
            var foundList = ListQueries.GetList(testList.ID);

            Assert.AreEqual(true, result);
            Assert.IsNotNull(foundList);
            Assert.AreEqual(1, foundList.LAListItems.Count);

            ListQueries.RemoveList(foundList.ID);
            Assert.AreEqual(2, ListQueries.GetLists().Count);
        }
示例#5
0
        public void TestRemoveNonExistingList()
        {
            var result = ListQueries.RemoveList(99);

            Assert.AreEqual(false, result);
            Assert.AreEqual(2, ListQueries.GetLists().Count);
        }
示例#6
0
        public void TestAddListWithItems()
        {
            var newList = new LAList()
            {
                Name = "List with items"
            };

            newList.LAListItems.Add(new LAListItem()
            {
                Description = "Test Item 1", Done = true
            });
            newList.LAListItems.Add(new LAListItem()
            {
                Description = "Test Item 2", Done = false
            });

            var result = ListQueries.AddList(newList);

            Assert.AreEqual(true, result);
            Assert.AreEqual(3, ListQueries.GetLists().Count);

            Assert.IsNotNull(newList);
            Assert.AreEqual(2, newList.LAListItems.Count);

            ListQueries.RemoveList(newList.ID);
            Assert.AreEqual(2, ListQueries.GetLists().Count);
        }
示例#7
0
        public void AddListWithNullName()
        {
            var newList = new LAList();
            var result  = ListQueries.AddList(newList);

            Assert.AreEqual(false, result);
            Assert.AreEqual(2, ListQueries.GetLists().Count);
        }
示例#8
0
        public void AddDuplicateList()
        {
            var newList = new LAList()
            {
                Name = "Groceries"
            };
            var result = ListQueries.AddList(newList);

            Assert.AreEqual(false, result);
            Assert.AreEqual(2, ListQueries.GetLists().Count);
        }
示例#9
0
        public HttpResponseMessage AllLists()
        {
            var test = listQueries.GetLists();

            return(Request.CreateResponse(HttpStatusCode.OK, listQueries.GetLists()));
        }