public void GetCategories_ReturnsAllItemCategories_CategoryList() { //Arrange ListMaker testItem = new ListMaker("Mow the lawn"); testItem.Save(); Category testCategory1 = new Category("Home stuff"); testCategory1.Save(); Category testCategory2 = new Category("Work stuff"); testCategory2.Save(); //Act testItem.AddCategory(testCategory1); List <Category> result = testItem.GetCategories(); List <Category> testList = new List <Category> { testCategory1 }; //Assert CollectionAssert.AreEqual(testList, result); }
public void AddCategory_AddsCategoryToItem_CategoryList() { //Arrange ListMaker testItem = new ListMaker("Mow the lawn"); testItem.Save(); Category testCategory = new Category("Home stuff"); testCategory.Save(); //Act testItem.AddCategory(testCategory); List <Category> result = testItem.GetCategories(); List <Category> testList = new List <Category> { testCategory }; //Assert CollectionAssert.AreEqual(testList, result); }
public void Delete_DeletesItemAssociationsFromDatabase_ItemList() { //Arrange Category testCategory = new Category("Home stuff"); testCategory.Save(); string testDescription = "Mow the lawn"; ListMaker testItem = new ListMaker(testDescription); testItem.Save(); //Act testItem.AddCategory(testCategory); testItem.Delete(); List <ListMaker> resultCategoryItems = testCategory.GetItems(); List <ListMaker> testCategoryItems = new List <ListMaker> { }; //Assert CollectionAssert.AreEqual(testCategoryItems, resultCategoryItems); }