Example #1
0
        public void FindPropertyInfos_ForClassWithOneSideRelationProperties()
        {
            var classDefinition = CreateClassDefinition(typeof(ClassWithVirtualRelationEndPoints));
            var propertyFinder  = new RelationPropertyFinder(
                typeof(ClassWithVirtualRelationEndPoints),
                true,
                true,
                new ReflectionBasedMemberInformationNameResolver(),
                classDefinition.PersistentMixinFinder,
                new PropertyMetadataReflector());

            Assert.That(
                propertyFinder.FindPropertyInfos(),
                Is.EquivalentTo(
                    new[]
            {
                GetProperty(typeof(ClassWithOneSideRelationPropertiesNotInMapping), "BaseBidirectionalOneToOne"),
                GetProperty(typeof(ClassWithOneSideRelationPropertiesNotInMapping), "BaseBidirectionalOneToMany"),
                GetProperty(typeof(ClassWithOneSideRelationPropertiesNotInMapping), "BasePrivateBidirectionalOneToOne"),
                GetProperty(typeof(ClassWithOneSideRelationPropertiesNotInMapping), "BasePrivateBidirectionalOneToMany"),
                GetProperty(typeof(ClassWithVirtualRelationEndPoints), "NoAttribute"),
                GetProperty(typeof(ClassWithVirtualRelationEndPoints), "NotNullable"),
                GetProperty(typeof(ClassWithVirtualRelationEndPoints), "BidirectionalOneToOne"),
                GetProperty(typeof(ClassWithVirtualRelationEndPoints), "BidirectionalOneToMany")
            }));
        }
Example #2
0
        private IEnumerable <IPropertyInformation> GetRelationPropertyInfos(ClassDefinition classDefinition)
        {
            var relationPropertyFinder = new RelationPropertyFinder(
                classDefinition.ClassType,
                classDefinition.BaseClass == null,
                true,
                _nameResolver,
                classDefinition.PersistentMixinFinder,
                _propertyMetadataProvider);

            return(relationPropertyFinder.FindPropertyInfos());
        }
Example #3
0
        public void Initialize()
        {
            var classDefinition = CreateClassDefinition(typeof(ClassWithDifferentProperties));
            var propertyFinder  = new RelationPropertyFinder(
                typeof(DerivedClassWithDifferentProperties),
                true,
                true,
                new ReflectionBasedMemberInformationNameResolver(),
                classDefinition.PersistentMixinFinder,
                new PropertyMetadataReflector());

            Assert.That(propertyFinder.Type, Is.SameAs(typeof(DerivedClassWithDifferentProperties)));
            Assert.That(propertyFinder.IncludeBaseProperties, Is.True);
        }
Example #4
0
        public void FindPropertyInfos_ForClassWithMixedProperties()
        {
            var classDefinition = CreateClassDefinition(typeof(ClassWithDifferentProperties));
            var propertyFinder  = new RelationPropertyFinder(
                typeof(ClassWithDifferentProperties),
                true,
                true,
                new ReflectionBasedMemberInformationNameResolver(),
                classDefinition.PersistentMixinFinder,
                new PropertyMetadataReflector());

            Assert.That(
                propertyFinder.FindPropertyInfos(),
                Is.EquivalentTo(
                    new[]
            {
                GetProperty(typeof(ClassWithDifferentPropertiesNotInMapping), "BaseUnidirectionalOneToOne"),
                GetProperty(typeof(ClassWithDifferentPropertiesNotInMapping), "BasePrivateUnidirectionalOneToOne"),
                GetProperty(typeof(ClassWithDifferentProperties), "UnidirectionalOneToOne")
            }));
        }