Exemplo n.º 1
0
        public void TestParameterIsSameAsPasses(string parameterName, Person parameterValue, Person parameterValue2, ClassValidator <Person> validatorBase, Action act)
        {
            "Given a new ValidatorBase"
            .x(() => validatorBase = Validate.That(parameterName, parameterValue));

            "Testing that the parameter is same as"
            .x(() => validatorBase.IsSameAs(parameterValue).OtherwiseThrowException());

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

            "Testing that the parameter is same as"
            .x(() => act = () => validatorBase.IsSameAs(parameterValue2).OtherwiseThrowException());

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