예제 #1
0
        public void TestParameterIsFalsePasses(string parameterName, bool parameterValue, BooleanValidator validatorBase)
        {
            "Given a new ValidatorBase"
            .x(() => validatorBase = Validate.That(parameterName, parameterValue));

            "Testing that the parameter is false"
            .x(() => validatorBase.IsFalse().OtherwiseThrowException());

            "Should not result in an exception"
            .x(() => validatorBase.CurrentException.Should().BeNull());
        }
예제 #2
0
        public void TestParameterIsFalseFails(string parameterName, bool parameterValue, BooleanValidator validatorBase, Action act)
        {
            "Given a new ValidatorBase"
            .x(() => validatorBase = Validate.That(parameterName, parameterValue));

            "Testing that the parameter is false"
            .x(() => act = () => validatorBase.IsFalse().OtherwiseThrowException());

            "Should throw an exception"
            .x(() => act.ShouldThrow <ArgumentException>()
               .WithMessage(string.Format(Resources.MustBeFalse + "\r\nParameter name: {0}", parameterName)));
        }