public void SetUp() { _collectorValidatorMock1 = MockRepository.GenerateStrictMock <ICollectorValidator>(); _collectorValidatorMock2 = MockRepository.GenerateStrictMock <ICollectorValidator> (); _collector = MockRepository.GenerateStub <IComponentValidationCollector>(); _compoundCollectorValidator = new CompoundCollectorValidator(new[] { _collectorValidatorMock1, _collectorValidatorMock2 }); }
public void SetUp() { _validationCollectorProviderMock = MockRepository.GenerateStrictMock <IValidationCollectorProvider>(); _validationCollectorMergerMock = MockRepository.GenerateStrictMock <IValidationCollectorMerger>(); _metaRulesValidatorFactoryStub = MockRepository.GenerateStub <IMetaRulesValidatorFactory>(); _metaRuleValidatorMock = MockRepository.GenerateStrictMock <IMetaRuleValidator>(); _validationRuleGlobalizationServiceMock = MockRepository.GenerateStrictMock <IValidationRuleMetadataService>(); _memberInformationNameResolverMock = MockRepository.GenerateStrictMock <IMemberInformationNameResolver>(); _collectorValidatorMock = MockRepository.GenerateStrictMock <ICollectorValidator> (); _metaValidationRule1Stub = MockRepository.GenerateStub <IAddingComponentPropertyMetaValidationRule>(); _metaValidationRule2Stub = MockRepository.GenerateStub <IAddingComponentPropertyMetaValidationRule>(); _metaValidationRule3Stub = MockRepository.GenerateStub <IAddingComponentPropertyMetaValidationRule>(); _componenValidationCollectorStub1 = MockRepository.GenerateStub <IComponentValidationCollector>(); _componenValidationCollectorStub1.Stub(stub => stub.AddedPropertyMetaValidationRules).Return(new[] { _metaValidationRule1Stub }); _componenValidationCollectorStub2 = MockRepository.GenerateStub <IComponentValidationCollector>(); _componenValidationCollectorStub2.Stub(stub => stub.AddedPropertyMetaValidationRules) .Return(new[] { _metaValidationRule2Stub, _metaValidationRule3Stub }); _componenValidationCollectorStub3 = MockRepository.GenerateStub <IComponentValidationCollector>(); _componenValidationCollectorStub3.Stub(stub => stub.AddedPropertyMetaValidationRules) .Return(new IAddingComponentPropertyMetaValidationRule[0]); _validationCollectorInfo1 = new ValidationCollectorInfo( _componenValidationCollectorStub1, typeof(ApiBasedComponentValidationCollectorProvider)); _validationCollectorInfo2 = new ValidationCollectorInfo( _componenValidationCollectorStub2, typeof(ApiBasedComponentValidationCollectorProvider)); _validationCollectorInfo3 = new ValidationCollectorInfo( _componenValidationCollectorStub3, typeof(ApiBasedComponentValidationCollectorProvider)); _validationRuleStub1 = MockRepository.GenerateStub <IValidationRule>(); _validationRuleStub2 = MockRepository.GenerateStub <IValidationRule>(); _validationRuleStub3 = PropertyRule.Create(ExpressionHelper.GetTypedMemberExpression <Customer, string> (c => c.FirstName)); _validationRuleStub4 = PropertyRule.Create(ExpressionHelper.GetTypedMemberExpression <Customer, string> (c => c.LastName)); _fakeValidationRuleResult = new[] { _validationRuleStub1, _validationRuleStub2, _validationRuleStub3, _validationRuleStub4 }; _fakeValidationCollectorMergeResult = new ValidationCollectorMergeResult(_fakeValidationRuleResult, MockRepository.GenerateStub <ILogContext>()); _fluentValidationBuilder = new FluentValidatorBuilder( _validationCollectorProviderMock, _validationCollectorMergerMock, _metaRulesValidatorFactoryStub, _validationRuleGlobalizationServiceMock, _memberInformationNameResolverMock, _collectorValidatorMock); _validMetaValidationResult1 = MetaValidationRuleValidationResult.CreateValidResult(); _validMetaValidationResult2 = MetaValidationRuleValidationResult.CreateValidResult(); _invalidMetaValidationResult1 = MetaValidationRuleValidationResult.CreateInvalidResult("Error1"); _invalidMetaValidationResult2 = MetaValidationRuleValidationResult.CreateInvalidResult("Error2"); }
public FluentValidatorBuilder( IValidationCollectorProvider validationCollectorProvider, IValidationCollectorMerger validationCollectorMerger, IMetaRulesValidatorFactory metaRuleValidatorFactory, IValidationRuleMetadataService validationRuleGlobalizationService, IMemberInformationNameResolver memberInformationNameResolver, ICollectorValidator collectorValidator) { ArgumentUtility.CheckNotNull("validationCollectorProvider", validationCollectorProvider); ArgumentUtility.CheckNotNull("validationCollectorMerger", validationCollectorMerger); ArgumentUtility.CheckNotNull("metaRuleValidatorFactory", metaRuleValidatorFactory); ArgumentUtility.CheckNotNull("validationRuleGlobalizationService", validationRuleGlobalizationService); ArgumentUtility.CheckNotNull("memberInformationNameResolver", memberInformationNameResolver); ArgumentUtility.CheckNotNull("collectorValidator", collectorValidator); _validationCollectorProvider = validationCollectorProvider; _validationCollectorMerger = validationCollectorMerger; _metaRulesValidatorFactory = metaRuleValidatorFactory; _validationRuleGlobalizationService = validationRuleGlobalizationService; _memberInformationNameResolver = memberInformationNameResolver; _collectorValidator = collectorValidator; }