示例#1
0
        public void SetUp()
        {
            _property = PropertyInfoAdapter.Create(typeof(Customer).GetProperty("UserName"));

            _userNameExpression = ExpressionHelper.GetTypedMemberExpression <Customer, string> (c => c.UserName);
            _lastNameExpression = ExpressionHelper.GetTypedMemberExpression <Customer, string> (c => c.LastName);

            _removingComponentPropertyRule = RemovingComponentPropertyRule.Create(_userNameExpression, typeof(RemovingComponentPropertyRuleTest));
        }
        public ValidatorRegistrationWithContext(
            ValidatorRegistration validatorRegistration,
            IRemovingComponentPropertyRule removingComponentPropertyRule)
        {
            ArgumentUtility.CheckNotNull("validatorRegistration", validatorRegistration);
            ArgumentUtility.CheckNotNull("removingComponentPropertyRule", removingComponentPropertyRule);

            _validatorRegistration         = validatorRegistration;
            _removingComponentPropertyRule = removingComponentPropertyRule;
        }
        public void SetUp()
        {
            _validatorRegistration1 = new ValidatorRegistration(typeof(NotEmptyValidator), null);
            _validatorRegistration2 = new ValidatorRegistration(typeof(NotEqualValidator), typeof(CustomerValidationCollector1));
            _validatorRegistration3 = new ValidatorRegistration(typeof(NotNullValidator), null);
            _validatorRegistration4 = new ValidatorRegistration(typeof(LengthValidator), typeof(CustomerValidationCollector2));
            _validatorRegistration5 = new ValidatorRegistration(typeof(NotEqualValidator), typeof(CustomerValidationCollector2));
            _validatorRegistration6 = new ValidatorRegistration(typeof(LengthValidator), null);

            _removingPropertyRuleStub1 = MockRepository.GenerateStub <IRemovingComponentPropertyRule>();
            _removingPropertyRuleStub1.Stub(stub => stub.Property).Return(PropertyInfoAdapter.Create(typeof(Customer).GetProperty("LastName")));
            _removingPropertyRuleStub2 = MockRepository.GenerateStub <IRemovingComponentPropertyRule>();
            _removingPropertyRuleStub2.Stub(stub => stub.Property).Return(PropertyInfoAdapter.Create(typeof(Customer).GetProperty("FirstName")));

            _registrationWithContext1 = new ValidatorRegistrationWithContext(_validatorRegistration1, _removingPropertyRuleStub1);
            _registrationWithContext2 = new ValidatorRegistrationWithContext(_validatorRegistration2, _removingPropertyRuleStub1);
            _registrationWithContext3 = new ValidatorRegistrationWithContext(_validatorRegistration3, _removingPropertyRuleStub1);
            _registrationWithContext4 = new ValidatorRegistrationWithContext(_validatorRegistration4, _removingPropertyRuleStub1);
            _registrationWithContext5 = new ValidatorRegistrationWithContext(_validatorRegistration5, _removingPropertyRuleStub1);
            _registrationWithContext6 = new ValidatorRegistrationWithContext(_validatorRegistration1, _removingPropertyRuleStub1);
            _registrationWithContext7 = new ValidatorRegistrationWithContext(_validatorRegistration6, _removingPropertyRuleStub2);
            //other property -> filtered!

            _stubPropertyValidator1 = new StubPropertyValidator();   //not extracted
            _stubPropertyValidator2 = new NotEmptyValidator(null);   //extracted
            _stubPropertyValidator3 = new NotEqualValidator("gfsf"); //extracted
            _stubPropertyValidator4 = new LengthValidator(0, 10);    //not extracted

            _logContextMock = MockRepository.GenerateStrictMock <ILogContext>();

            _extractor = new PropertyValidatorExtractor(
                new[]
            {
                _registrationWithContext1, _registrationWithContext2, _registrationWithContext3, _registrationWithContext4,
                _registrationWithContext5, _registrationWithContext6, _registrationWithContext7
            },
                _logContextMock);
        }
示例#4
0
 public void SetUp()
 {
     _validatorRegistration    = new ValidatorRegistration(typeof(NotEqualValidator), null);
     _removingPropertyRuleStub = MockRepository.GenerateStub <IRemovingComponentPropertyRule>();
     _registrationWithContext  = new ValidatorRegistrationWithContext(_validatorRegistration, _removingPropertyRuleStub);
 }
示例#5
0
 public void SetUp()
 {
     _removingComponentPropertyRuleMock = MockRepository.GenerateStrictMock <IRemovingComponentPropertyRule>();
     _addingComponentBuilder            = new RemovingComponentRuleBuilder <Customer, string> (_removingComponentPropertyRuleMock);
 }
示例#6
0
        public RemovingComponentRuleBuilder(IRemovingComponentPropertyRule removingComponentPropertyPropertyRule)
        {
            ArgumentUtility.CheckNotNull("removingComponentPropertyPropertyRule", removingComponentPropertyPropertyRule);

            _removingComponentPropertyRule = removingComponentPropertyPropertyRule;
        }