Exemplo n.º 1
0
        public virtual void TestParameterNotNullPasses(string parameterName, Person parameterValue, ClassValidator <Person> validatorBase)
        {
            "And given a new ValidatorBase"
            .x(() => validatorBase = Validate.That(parameterName, parameterValue));

            "Testing that the parameter is not null"
            .x(() => validatorBase.IsNotNull().OtherwiseThrowException());

            "Should not result in an exception"
            .x(() => validatorBase.CurrentException.Should().BeNull());
        }
Exemplo n.º 2
0
        public virtual void TestParameterNotNullFails(string parameterName, Person parameterValue, ClassValidator <Person> validatorBase, Action act)
        {
            "Given a new ValidatorBase"
            .x(() => validatorBase = Validate.That(parameterName, parameterValue));

            "Testing that the parameter is not null"
            .x(() => act = () => validatorBase.IsNotNull().OtherwiseThrowException());

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