public void TestParameterIsTruePasses(string parameterName, bool?parameterValue, NullableBooleanValidator validatorBase) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter is true" .x(() => validatorBase.IsTrue().OtherwiseThrowException()); "Should not result in an exception" .x(() => validatorBase.CurrentException.Should().BeNull()); }
public void TestParameterIsTrueFails(string parameterName, bool?parameterValue, NullableBooleanValidator validatorBase, Action act) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter is true" .x(() => act = () => validatorBase.IsTrue().OtherwiseThrowException()); "Should throw an exception" .x(() => act.ShouldThrow <ArgumentException>() .WithMessage(string.Format(Resources.MustBeTrue + "\r\nParameter name: {0}", parameterName))); }