示例#1
0
 public void ItShouldAssignTagToTask()
 {
     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");
     testList.SetTasks(tagTasks.GetTasks());
     string actual = testList.GetTask(0).TagList.GetTag(0).Name;
     string expected = "urgent";
     Assert.AreEqual(expected, actual);
 }
示例#2
0
 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);
 }
示例#3
0
 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);
 }