private ManualResetEventSlim StartSearchInBackground(string searchString) { ManualResetEventSlim resetEvent = new ManualResetEventSlim(false); Task.Factory.StartNew(() => { IEverything everything = new Everything(); everything.MatchWholeWord = true; // Act var results = everything .Search() .Name .Contains(searchString); // Assert Assert.That(this.everyThing.LastErrorCode, Is.EqualTo(ErrorCode.Ok)); Assert.That(results, Is.Not.Empty); foreach (var result in results) { StringAssert.Contains(searchString, result.FileName); } resetEvent.Set(); }); return(resetEvent); }
public long QueryAndQuery() { var everything = new Everything(); var queryable1 = everything .Search() .Name.Contains("windows"); var queryable2 = everything .Search() .Size.LessThan(1, SizeUnit.Mb); return(everything .Search() .Queryable(queryable1) .And .Queryable(queryable2) .Count); }
public void MultipleInstances() { var firstResult = this.everyThing .Search() .Name .Contains("IImageQueryable.cs"); IEverything secondEverything = new Everything(); var secondResult = secondEverything .Search() .Name .Contains("IMusicQueryable.cs"); Assert.That(firstResult.First().FileName, Is.EqualTo("IImageQueryable.cs")); Assert.That(secondResult.First().FileName, Is.EqualTo("IMusicQueryable.cs")); }
static void Main(string[] args) { Console.WriteLine("Enter your search query:"); var qry = Console.ReadLine(); var results = Everything.Search(qry); var resultCount = 0; foreach (var result in results) { resultCount++; if (resultCount > MAX_RESULTS) { break; } Console.WriteLine($"{resultCount:D2}. {result.ToString()}"); } }