Use the static class TestHelper
to help assert guard clause, exceptions, and more.
Use the static class TestValues
to use some common objects in a way that doesn't clutter your testing, and let your code be your comments for your tests. Pass the following to your functions:
Class.Function(TestValues.EmptyString);
instead of
Class.Function(null);
[Fact]
public void Test()
{
var ex = Assert.Throws<ArgumentNullException>(() => Class.Function(null));
TestHelper.AssertArgumentNullException(exception: exception,
parameterName: "parameterName");
}
[TestCase]
public void Test()
{
var ex = Assert.Throws<ArgumentNullException>(() => Class.Function(null));
TestHelper.AssertArgumentNullException(exception: exception,
parameterName: "parameterName");
}