public void TestParameterEqualToPasses( string parameterName, uint parameterValue, uint valueToCompare, UnsignedNumericValidator <uint> validatorBase) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter value is equal to the value to compare against" .x(() => validatorBase.IsEqualTo(valueToCompare).OtherwiseThrowException()); "Should not result in an exception" .x(() => validatorBase.CurrentException.Should().BeNull()); }
public void TestParameterEqualToFails( string parameterName, uint parameterValue, uint valueToCompare, UnsignedNumericValidator <uint> validatorBase, Action act) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter value is equal to the value to compare against" .x(() => act = () => validatorBase.IsEqualTo(valueToCompare).OtherwiseThrowException()); "Should throw an exception" .x(() => act.ShouldThrow <ArgumentEqualityException>() .WithMessage(string.Format(Resources.MustBeEqualToX + "\r\nParameter name: {1}", valueToCompare, parameterName))); }