public void TestParameterGreaterThanOrEqualToPasses( string parameterName, DateTime?parameterValue, DateTime?valueToCompare, NullableDateTimeValidator validatorBase) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter value is greater than or equal to the value to compare against" .x(() => validatorBase.IsGreaterThanOrEqualTo(valueToCompare).OtherwiseThrowException()); "Should not result in an exception" .x(() => validatorBase.CurrentException.Should().BeNull()); }
public void TestParameterGreaterThanOrEqualToFails( string parameterName, DateTime?parameterValue, DateTime?valueToCompare, NullableDateTimeValidator validatorBase, Action act) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter value is greater than or equal to the value to compare against" .x(() => act = () => validatorBase.IsGreaterThanOrEqualTo(valueToCompare).OtherwiseThrowException()); "Should throw an exception" .x(() => act.ShouldThrow <ArgumentOutOfRangeException>() .WithMessage(string.Format(Resources.MustBeGreaterThanOrEqualToX + "\r\nParameter name: {1}", valueToCompare, parameterName))); }