本文整理汇总了C#中TagList.AddTag方法的典型用法代码示例。如果您正苦于以下问题:C# TagList.AddTag方法的具体用法?C# TagList.AddTag怎么用?C# TagList.AddTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagList
的用法示例。
在下文中一共展示了TagList.AddTag方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItShouldNotAddTagsWithSameName
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: ItShouldGetTagIndex
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: ItShouldGetTag
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: ItShouldCheckForTags
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: LoadTasks
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: Execute
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");
}
}