public void ListTags(TagList tagList, TaskList tasklist) { TaskTagger tagTasks = new TaskTagger(tasklist.GetTasks()); FileStream fs = new FileStream(@"Export.html", FileMode.Create); StreamWriter sw = new StreamWriter(fs); sw.Write("<h2> Tags and the number of tasks they are assigned to: </h2>"); sw.Write("<ul>"); foreach (Tag tg in tagList) sw.Write("<li>" + tg.Name + ": " + tagTasks.CountTag(tg.Name) + "</li>"); sw.Write("</ul>"); sw.Close(); Process.Start("IExplore.exe", Directory.GetCurrentDirectory() + "\\Export.html"); }
public void ListTags(TagList tagList, TaskList tasklist) { TaskTagger tagTasks = new TaskTagger(tasklist.GetTasks()); Console.WriteLine("Tags and the number of tasks they are assigned to:"); foreach (Tag tg in tagList) Console.Write(tg.Name + ":" + tagTasks.CountTag(tg.Name) + " "); Console.WriteLine(); }
public void ItShouldCountTagsFromEveryTask() { 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"); int actual = tagTasks.CountTag("important"); int expected = 2; Assert.AreEqual(expected, actual); }