Created
December 22, 2015 21:44
-
-
Save miklund/7b6e7d39f2b29fa17a45 to your computer and use it in GitHub Desktop.
2009-04-21 Asserting with Exceptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Title: Asserting with Exceptions | |
# Author: Mikael Lundin | |
# Link: http://blog.mikaellundin.name/2009/04/21/asserting-with-exceptions.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string Reverse(string argument) | |
{ | |
argument.AssertThat(s => s != null, | |
"Failed assertion: Argument was null"); | |
// ... logic ... | |
// return result; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string Reverse(string argument) | |
{ | |
if (argument == null) | |
throw new ArgumentNullException("argument"); | |
// ... logic ... | |
// return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment