コード例 #1
0
 public void ItShouldNotAddTagsWithSameName()
 {
     Tag tag1 = new Tag("urgent");
     Tag tag2 = new Tag("urgent");
     TagList testTaglist = new TagList();
     testTaglist.AddTag(ref tag1);
     testTaglist.AddTag(ref tag2);
     int expected = 1;
     int actual = testTaglist.GetListSize();
     Assert.AreEqual(expected, actual);
 }
コード例 #2
0
 public void ItShouldGetTagIndex()
 {
     Tag tag1 = new Tag("urgent");
     Tag tag2 = new Tag("important");
     TagList testTaglist = new TagList();
     testTaglist.AddTag(ref tag1);
     testTaglist.AddTag(ref tag2);
     int expected = 1;
     int actual = testTaglist.GetTagIndex("important");
     Assert.AreEqual(expected, actual);
 }
コード例 #3
0
 public void ItShouldGetTag()
 {
     Tag tag1 = new Tag("urgent");
     Tag tag2 = new Tag("important");
     TagList testTaglist = new TagList();
     testTaglist.AddTag(ref tag1);
     testTaglist.AddTag(ref tag2);
     string expected = "important";
     string actual = testTaglist.GetTag(1).Name;
     Assert.AreEqual(expected, actual);
 }
コード例 #4
0
 public void ItShouldCheckForTags()
 {
     Tag tag1 = new Tag("urgent");
     Tag tag2 = new Tag("important");
     TagList testTaglist = new TagList();
     testTaglist.AddTag(ref tag1);
     testTaglist.AddTag(ref tag2);
     bool expected = true;
     bool actual = testTaglist.HasTag("important");
     Assert.AreEqual(expected, actual);
 }
コード例 #5
0
ファイル: FileIO.cs プロジェクト: bogdanuifalean/JuniorMind
        public void LoadTasks(TaskList taskList)
        {
            string[] lines = System.IO.File.ReadAllLines(@"List.txt");
            foreach (string line in lines)
            {
                Task task = new Task();
                var items = line.Split(';');
                task.TaskDescription = items[1];
                if (items[0] == "[X]")
                {
                    task.IsDone = true;
                }

                task.IsNewTask = false;
                task.TaskId = items[2];
                task.DueDate = Convert.ToDateTime(items[3]);
                task.DoneDate = Convert.ToDateTime(items[4]);
                int i = items.Length;
                TagList tags = new TagList();
                while (i > 5)
                {
                    Tag tag = new Tag(items[i - 1]);
                    tags.AddTag(ref tag);
                    i--;
                }

                task.TagList = tags;
                taskList.AddTask(ref task);
            }
        }
コード例 #6
0
 public void Execute(ArgumentList arguments, TaskList tasks, TagList tags, TagFolder folder)
 {
     FileIO loader = new FileIO();
     TaskTagger tagTasks = new TaskTagger(tasks.GetTasks());
     if (arguments.GetLength() == 2)
     {
         Tag tag = new Tag(arguments.GetParameter(1));
         tags.AddTag(ref tag);
         loader.SaveTags(tags);
     }
     else
     {
         if (tagTasks.AssignTag(arguments.GetParameter(1), arguments.GetParameter(2)))
         {
             loader.SaveTasks(tagTasks.GetTasks());
             Tag tag = new Tag(arguments.GetParameter(2));
             tags.AddTag(ref tag);
             loader.SaveTags(tags);
         }
         else
             Console.WriteLine("No task with that id found to tag");
     }
 }