Ejemplo n.º 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")
            }));
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 3
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")
            }));
        }