Skip to content

Instantly share code, notes, and snippets.

@g0t4
Last active January 2, 2016 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g0t4/8337974 to your computer and use it in GitHub Desktop.
Save g0t4/8337974 to your computer and use it in GitHub Desktop.
[Test]
[Timeout(2000)]
public async Task WriteToFile_StreamsChanged()
{
using (var watcher = new ObservableFileSystemWatcher(c => { c.Path = TempPath; }))
{
var firstChanged = watcher.Changed.FirstAsync().ToTask();
watcher.Start();
File.WriteAllText(Path.Combine(TempPath, "Changed.Txt"), "foo");
var changed = await firstChanged;
Expect(changed.ChangeType, Is.EqualTo(WatcherChangeTypes.Changed));
Expect(changed.Name, Is.EqualTo("Changed.Txt"));
}
}
@g0t4
Copy link
Author

g0t4 commented Jan 9, 2014

This is a gist of this my post c# async/await makes reactive testing expressive!

@domartynov
Copy link

Wes, what's the assert library used here? i mean the piece: Exepect(..., Is.EqualTo(...)) Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment