public async void FileIndexingEvents_FileCreatedToWatchedDirectory_Raised(string eventName) { var engine = SearchEngineFactory.New(); var tcs = new TaskCompletionSource <bool>(); using (var folder = new TestFolder()) { var fileName = TestFile.GenerateFileName(); var folderPath = folder.Path; engine.Add(folderPath); await Task.Delay(100); engine.AddHandler(eventName, args => { tcs.TrySetResult(Path.GetFullPath($"{folderPath}\\{fileName}") == args.Path); }); using (new TestFile("foo", folderPath, fileName)) { Assert.True(await tcs.Task); } await Task.Delay(100); } }