public void ValidateWithOneRelationDefinition_ValidResult()
        {
            var validator = new SortExpressionValidator(_validationRuleMock);

            _validationRuleMock.Expect(mock => mock.Validate(_relationDefinition1)).Return(_fakeValidMappingValidationResult);
            _validationRuleMock.Replay();

            var mappingValidationResults = validator.Validate(new[] { _relationDefinition1 }).ToArray();

            _validationRuleMock.VerifyAllExpectations();
            Assert.That(mappingValidationResults.Length, Is.EqualTo(0));
        }
示例#2
0
        public void ValidateWithSeveralRulesAndClassDefinitions_ValidResult()
        {
            var validator = new RelationDefinitionValidator(_validationRuleMock1, _validationRuleMock2, _validationRuleMock3);

            _validationRuleMock1.Expect(mock => mock.Validate(_relationDefinition1)).Return(_fakeValidMappingValidationResult);
            _validationRuleMock1.Expect(mock => mock.Validate(_relationDefinition2)).Return(_fakeValidMappingValidationResult);
            _validationRuleMock1.Expect(mock => mock.Validate(_relationDefinition3)).Return(_fakeValidMappingValidationResult);
            _validationRuleMock2.Expect(mock => mock.Validate(_relationDefinition1)).Return(_fakeValidMappingValidationResult);
            _validationRuleMock2.Expect(mock => mock.Validate(_relationDefinition2)).Return(_fakeValidMappingValidationResult);
            _validationRuleMock2.Expect(mock => mock.Validate(_relationDefinition3)).Return(_fakeValidMappingValidationResult);
            _validationRuleMock3.Expect(mock => mock.Validate(_relationDefinition1)).Return(_fakeValidMappingValidationResult);
            _validationRuleMock3.Expect(mock => mock.Validate(_relationDefinition2)).Return(_fakeValidMappingValidationResult);
            _validationRuleMock3.Expect(mock => mock.Validate(_relationDefinition3)).Return(_fakeValidMappingValidationResult);
            _validationRuleMock1.Replay();

            var mappingValidationResults = validator.Validate(new[] { _relationDefinition1, _relationDefinition2, _relationDefinition3 }).ToArray();

            _validationRuleMock1.VerifyAllExpectations();
            Assert.That(validator.ValidationRules.Count, Is.EqualTo(3));
            Assert.That(mappingValidationResults.Length, Is.EqualTo(0));
        }