public void UnscheduleFromRunLoopTest() { string path = Path.Combine(dirPath, "TempFileToWatch.txt"); var taskCompletionSource = new TaskCompletionSource <FSEventStreamEventsArgs> (); FSEventStreamEventsArgs args = null; TestRuntime.RunAsync(TimeSpan.FromSeconds(30), async() => { fsEventStream.Events += (sender, eventArgs) => { taskCompletionSource.SetResult(eventArgs); watchedFileChanged = true; }; fsEventStream.ScheduleWithRunLoop(CFRunLoop.Current); // need to schedule first before calling unschedule fsEventStream.UnscheduleFromRunLoop(CFRunLoop.Current); // unscheduling from the RunLoop shouldn't trigger events fsEventStreamStarted = fsEventStream.Start(); File.AppendAllText(path, "Hello World!"); Assert.IsTrue(File.Exists(path)); args = await taskCompletionSource.Task.ConfigureAwait(false); }, () => watchedFileChanged); Assert.IsNull(args, "Null args"); }