Last active
December 24, 2015 12:29
-
-
Save reidev275/6798353 to your computer and use it in GitHub Desktop.
test helper method
This file contains 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
using NUnit.Framework; | |
[TestFixture] | |
public class Given_we_are_creating_an_object_with_a_single_string_parameter | |
{ | |
[Test] | |
public void We_sould_test_for_null_or_whitespace_parameters() | |
{ | |
TestHelpers.NullOrWhitespaceTest((s) => new ObjectWithStringParameter(s)); | |
} | |
} |
This file contains 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
using NUnit.Framework; | |
[TestFixture] | |
public class Given_we_are_creating_an_object_with_multiple_parameters | |
{ | |
[Test] | |
public void We_sould_test_for_null_or_whitespace_parameters() | |
{ | |
TestHelpers.NullOrWhitespaceTest((s) => new ObjectWithMultipleParameters(new MyMockObject(), s)); | |
} | |
} |
This file contains 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
using NUnit.Framework; | |
using System; | |
public class TestHelpers | |
{ | |
public static void NullOrWhitespaceTest(Action<string> action) | |
{ | |
Assert.Throws<ArgumentException>(() => action("")); | |
Assert.Throws<ArgumentNullException>(() => action(null)); | |
Assert.Throws<ArgumentException>(() => action(" ")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment