Esempio n. 1
0
        public void CreateNewFinder()
        {
            var classDefinition = CreateClassDefinition(typeof(DerivedClassWithMappingAttribute));
            var nameResolver    = new ReflectionBasedMemberInformationNameResolver();
            IPropertyMetadataProvider propertyMetadataReflector = new PropertyMetadataReflector();
            var propertyFinder = new NameBasedPropertyFinder(
                "Property2",
                typeof(DerivedClassWithMappingAttribute),
                true,
                true,
                nameResolver,
                classDefinition.PersistentMixinFinder,
                propertyMetadataReflector);

            var result = (NameBasedPropertyFinder)PrivateInvoke.InvokeNonPublicMethod(
                propertyFinder,
                "CreateNewFinder",
                typeof(string),
                true,
                true,
                nameResolver,
                classDefinition.PersistentMixinFinder,
                propertyMetadataReflector);

            Assert.That(result.Type, Is.SameAs(typeof(string)));
            Assert.That(result.IncludeBaseProperties, Is.True);
            Assert.That(result.IncludeMixinProperties, Is.True);
            Assert.That(result.NameResolver, Is.SameAs(nameResolver));
            Assert.That(PrivateInvoke.GetNonPublicField(result, "_propertyName"), Is.EqualTo("Property2"));
        }
        public override void SetUp()
        {
            base.SetUp();

            _emptyClassDefinitions    = new ClassDefinition[0];
            _emptyRelationDefinitions = new RelationDefinition[0];

            _memberInformationNameResolver = new ReflectionBasedMemberInformationNameResolver();
            _mockRepository    = new MockRepository();
            _mockMappingLoader = _mockRepository.StrictMock <IMappingLoader>();

            _fakeStorageEntityDefinition = TableDefinitionObjectMother.Create(
                DomainObjectsConfiguration.Current.Storage.DefaultStorageProviderDefinition, new EntityNameDefinition(null, "Test"));
        }
        public override void SetUp()
        {
            base.SetUp();

            _mappingMemberInformationNameResolver = new ReflectionBasedMemberInformationNameResolver();
            _domainObjectCreator = new ThrowingDomainObjectCreator();

            _factory = new ReflectionBasedMappingObjectFactory(
                _mappingMemberInformationNameResolver,
                new ClassIDProvider(),
                new PropertyMetadataReflector(),
                new DomainModelConstraintProvider(),
                _domainObjectCreator);
        }
        public override void SetUp()
        {
            base.SetUp();
            _memberInformationNameResolver  = new ReflectionBasedMemberInformationNameResolver();
            _classWithRealRelationEndPoints = ClassDefinitionObjectMother.CreateClassDefinitionWithMixins(typeof(ClassWithRealRelationEndPoints));
            _classWithRealRelationEndPoints.SetPropertyDefinitions(new PropertyDefinitionCollection());
            _classWithRealRelationEndPoints.SetRelationEndPointDefinitions(new RelationEndPointDefinitionCollection());

            _classWithVirtualRelationEndPoints = ClassDefinitionObjectMother.CreateClassDefinitionWithMixins(typeof(ClassWithVirtualRelationEndPoints));
            _classWithVirtualRelationEndPoints.SetPropertyDefinitions(new PropertyDefinitionCollection());
            _classWithVirtualRelationEndPoints.SetRelationEndPointDefinitions(new RelationEndPointDefinitionCollection());

            _classWithBothEndPointsOnSameClassClassDefinition =
                ClassDefinitionObjectMother.CreateClassDefinitionWithMixins(typeof(ClassWithBothEndPointsOnSameClass));
            _classWithBothEndPointsOnSameClassClassDefinition.SetPropertyDefinitions(new PropertyDefinitionCollection());
            _classWithBothEndPointsOnSameClassClassDefinition.SetRelationEndPointDefinitions(new RelationEndPointDefinitionCollection());

            _classDefinitions = new[]
            {
                _classWithRealRelationEndPoints,
                _classWithVirtualRelationEndPoints,
                _classWithBothEndPointsOnSameClassClassDefinition
            }.ToDictionary(cd => cd.ClassType);
        }
 public void SetUp()
 {
     _resolver = new ReflectionBasedMemberInformationNameResolver();
     _propertyInformationStub = MockRepository.GenerateStub <IPropertyInformation>();
     _typeInformationStub     = MockRepository.GenerateStub <ITypeInformation>();
 }