Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Async lambda support in NUnit framework
public async Task AsyncLambaSupport()
// throwing asynchronously
Assert.That(async () => await ThrowAsync(), Throws.TypeOf<InvalidOperationException>());
// returning values asynchronously
Assert.That(async () => await ReturnOneAsync(), Is.EqualTo(1));
// "After" works with async methods too
Assert.That(async () => await ResutnOneAsync(), Is.EqualTo(1).After(100));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.