本文整理汇总了C#中TaskList.Search方法的典型用法代码示例。如果您正苦于以下问题:C# TaskList.Search方法的具体用法?C# TaskList.Search怎么用?C# TaskList.Search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskList
的用法示例。
在下文中一共展示了TaskList.Search方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Search
public void Search()
{
string tempTasksFile = CreateTempTasksFile();
var tl = new TaskList(tempTasksFile);
// There should be two task which contain the term 'foo'
TaskList fooTaskList = tl.Search("foo");
Assert.IsNotNull(fooTaskList);
Assert.AreEqual(2, fooTaskList.Count);
// Search should be case insenstive
TaskList caseInsensitiveTaskList = tl.Search("Foo");
Assert.IsNotNull(caseInsensitiveTaskList);
Assert.AreEqual(2, caseInsensitiveTaskList.Count);
// '-' in front of the term should find all tasks without the term
TaskList notFooTaskList = tl.Search("-foo");
// So searching the list generated by the negative search for the term
// should give us an empty list
Assert.AreEqual(0, notFooTaskList.Search("foo").Count);
}
示例2: LoadTasksFromString
public void LoadTasksFromString()
{
var text = @"
this is the first task
this is the second task
the previous line was blank";
var tl = new TaskList();
tl.LoadTasksFromString(text);
Assert.That(tl.Count == 5);
Assert.That(tl.Search("previous").Any());
}