public void TestParameterIsNullPasses(string parameterName, Person parameterValue, ClassValidator <Person> validatorBase) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter is null" .x(() => validatorBase.IsNull().OtherwiseThrowException()); "Should not result in an exception" .x(() => validatorBase.CurrentException.Should().BeNull()); }
public void TestParameterIsNullFails(string parameterName, Person parameterValue, ClassValidator <Person> validatorBase, Action act) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter is null" .x(() => act = () => validatorBase.IsNull().OtherwiseThrowException()); "Should throw an exception" .x(() => act.ShouldThrow <ArgumentException>() .WithMessage(string.Format(Resources.MustBeNull + "\r\nParameter name: {0}", parameterName))); }