Skip to content

Instantly share code, notes, and snippets.

@kkozmic
Created November 1, 2009 15:18
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 kkozmic/223552 to your computer and use it in GitHub Desktop.
Save kkozmic/223552 to your computer and use it in GitHub Desktop.
//rather than this...
var ex = Assert.Throws<FooException>(()=>foo.DoFoo("bar"));
Assert.Contains("bar should be foo", ex.Message);
// ... I'd prefer this
Assert.Throws<FooException>(()=>foo.DoFoo("bar"),(ex)=>
Assert.Contains("bar should be foo", ex.Message));
//it's cleaner to read, especially for more complicated scenarios.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment