public void TestParameterNotEqualToFails(string parameterName, bool?parameterValue, bool?valueToCompare, NullableBooleanValidator 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.IsNotEqualTo(valueToCompare).OtherwiseThrowException());

            "Should throw an exception"
            .x(() => act.ShouldThrow <ArgumentEqualityException>()
               .WithMessage(string.Format(Resources.MustNotBeEqualToX + "\r\nParameter name: {1}", valueToCompare, parameterName)));
        }
        public void TestParameterEqualToPasses(string parameterName, bool?parameterValue, bool?valueToCompare, NullableBooleanValidator 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 TestParameterIsNullPasses(string parameterName, bool?parameterValue, NullableBooleanValidator 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, bool?parameterValue, NullableBooleanValidator 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 <ArgumentNullException>()
               .WithMessage(string.Format(Resources.MustBeNull + "\r\nParameter name: {0}", parameterName)));
        }
예제 #5
0
 public static NullableBooleanValidator That(string nameOfParameter, bool?parameterValue)
 {
     return(NullableBooleanValidator.GetInstance(nameOfParameter, parameterValue));
 }