public void ItShouldAssignMultipleTagsToTask() { TaskList testList = new TaskList(); Task testTask1 = new Task(); testTask1.TaskDescription = "First task"; testList.AddTask(ref testTask1); TaskTagger tagTasks = new TaskTagger(testList.GetTasks()); tagTasks.AssignTag(testTask1.TaskId, "urgent"); tagTasks.AssignTag(testTask1.TaskId, "important"); testList.SetTasks(tagTasks.GetTasks()); string actual = testList.GetTask(0).TagList.GetTag(1).Name; string expected = "important"; Assert.AreEqual(expected, actual); }
public void ItShouldFilterTasksByTaglist() { TaskList testList = new TaskList(); Task testTask1 = new Task(); testTask1.TaskDescription = "First task"; testTask1.TaskId = "AAAA"; Task testTask2 = new Task(); testTask2.TaskDescription = "Second"; testTask2.TaskId = "BBBB"; Task testTask3 = new Task(); testTask3.TaskId = "CCCC"; testTask3.TaskDescription = "Third task"; testList.AddTask(ref testTask1); testList.AddTask(ref testTask2); testList.AddTask(ref testTask3); TaskTagger tagTasks = new TaskTagger(testList.GetTasks()); tagTasks.AssignTag(testTask1.TaskId, "funny"); tagTasks.AssignTag(testTask2.TaskId, "sad"); tagTasks.AssignTag(testTask3.TaskId, "happy"); testList.SetTasks(tagTasks.GetTasks()); var taglist = new List<Tag>(); Tag happy = new Tag("happy"); Tag sad = new Tag("sad"); taglist.Add(sad); taglist.Add(happy); List<Task> filteredList = testList.FilterByTagList(taglist); var actual = filteredList; var expected = new List<Task>(); expected.Add(testList.GetTask(1)); expected.Add(testList.GetTask(2)); CollectionAssert.AreEqual(expected, actual); }
public void ItShouldDeleteTagFromEveryTask() { TaskList testList = new TaskList(); Task testTask1 = new Task(); testTask1.TaskDescription = "First task"; testTask1.TaskId = "AAAA"; testList.AddTask(ref testTask1); Task testTask2 = new Task(); testTask2.TaskDescription = "Second task"; testTask2.TaskId = "XXXX"; testList.AddTask(ref testTask2); TaskTagger tagTasks = new TaskTagger(testList.GetTasks()); tagTasks.AssignTag(testTask1.TaskId, "urgent"); tagTasks.AssignTag(testTask1.TaskId, "important"); tagTasks.AssignTag(testTask2.TaskId, "important"); tagTasks.DeleteTag("important"); testList.SetTasks(tagTasks.GetTasks()); int actual = testList.GetTask(0).TagList.GetListSize()+testList.GetTask(1).TagList.GetListSize(); int expected = 1; Assert.AreEqual(expected, actual); }