示例#1
0
        protected override void beforeEach()
        {
            theModel         = new SimpleModel();
            theRecordingRule = new RecordingValidationRule();

            var theSource = ConfiguredValidationSource.For(theModel.GetType(), theRecordingRule);

            theGraph = ValidationGraph.For(theSource);

            Services.Inject <ITypeResolver>(new TypeResolver());
            Services.Inject(theGraph);

            ClassUnderTest.Validate(theModel);

            theContext = theRecordingRule.Context;
        }
示例#2
0
        public void SetUp()
        {
            theModel = new ContactModel();
            theType  = theModel.GetType();

            r1 = MockRepository.GenerateStub <IValidationRule>();
            r2 = MockRepository.GenerateStub <IValidationRule>();
            r3 = MockRepository.GenerateStub <IValidationRule>();

            theMatchingSource = ConfiguredValidationSource.For(type => type == theType, r1, r2);
            theOtherSource    = ConfiguredValidationSource.For(type => type == typeof(int), r3);

            theGraph = ValidationGraph.BasicGraph();
            theGraph.RegisterSource(theMatchingSource);
            theGraph.RegisterSource(theOtherSource);

            theContext = ValidationContext.For(theModel);

            thePlan = ValidationPlan.For(theType, theGraph);
        }