public async Task PollExisting_FileBeforeStart_StreamsDropped() { using (var watcher = new FileDropWatcher(TempPath, "Monitored.Txt")) { var firstDropped = watcher.Dropped.FirstAsync().ToTask(); var monitoredFile = Path.Combine(TempPath, "Monitored.Txt"); File.WriteAllText(monitoredFile, "foo"); watcher.PollExisting(); var dropped = await firstDropped; Expect(dropped.Name, Is.EqualTo("Monitored.Txt")); Expect(dropped.FullPath, Is.EqualTo(monitoredFile)); } }
public async Task PollExisting_SecondTime_StreamsSecondTime() { using (var watcher = new FileDropWatcher(TempPath, "Monitored.Txt")) { var secondDropped = watcher.Dropped.Skip(1).FirstAsync().ToTask(); var monitoredFile = Path.Combine(TempPath, "Monitored.Txt"); File.WriteAllText(monitoredFile, "foo"); watcher.PollExisting(); watcher.PollExisting(); var dropped = await secondDropped; Expect(dropped.Name, Is.EqualTo("Monitored.Txt")); Expect(dropped.FullPath, Is.EqualTo(monitoredFile)); } }