public void AddDuplicateList() { var newList = "Test List 1"; var result = listQueries.AddList(newList); Assert.AreEqual(false, result); Assert.AreEqual(4, db.LALists.ToList().Count); }
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); }
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); }
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); }
public void AddListWithNullName() { var newList = new LAList(); var result = ListQueries.AddList(newList); Assert.AreEqual(false, result); Assert.AreEqual(2, ListQueries.GetLists().Count); }
public void AddDuplicateList() { var newList = new LAList() { Name = "Groceries" }; var result = ListQueries.AddList(newList); Assert.AreEqual(false, result); Assert.AreEqual(2, ListQueries.GetLists().Count); }
public HttpResponseMessage AddList(string listName) { int insertedId = listQueries.AddList(listName); if (insertedId > 0) { return(Request.CreateResponse(HttpStatusCode.OK, insertedId)); } return(Request.CreateResponse(HttpStatusCode.InternalServerError)); }
public void TestRemoveList() { LAList testList = new LAList() { Name = "List to Remove" }; ListQueries.AddList(testList); var findList = ListQueries.GetList(testList.ID); Assert.IsNotNull(findList, "Test List not found."); Assert.AreEqual <string>("List to Remove", findList.Name); var result = ListQueries.RemoveList(findList.ID); Assert.AreEqual(true, result); Assert.IsNull(ListQueries.GetList(3), "List 3 not removed."); }