Beispiel #1
0
        public void IsVirtualEndRelationEndpoint_WithCollectionPropertyAndWithoutAttribute()
        {
            var type         = typeof(ClassWithInvalidUnidirectionalRelation);
            var propertyInfo = PropertyInfoAdapter.Create(type.GetProperty("LeftSide"));
            var relationEndPointReflector = RelationEndPointReflector.CreateRelationEndPointReflector(
                ClassDefinitionObjectMother.CreateClassDefinition(classType: type),
                propertyInfo,
                Configuration.NameResolver,
                PropertyMetadataProvider,
                DomainModelConstraintProviderStub);

            Assert.That(relationEndPointReflector.IsVirtualEndRelationEndpoint(), Is.False);
        }
Beispiel #2
0
        public void CreateRelationEndPointReflector()
        {
            var type         = typeof(ClassWithVirtualRelationEndPoints);
            var propertyInfo = PropertyInfoAdapter.Create(type.GetProperty("NoAttribute"));

            Assert.IsInstanceOf(
                typeof(RdbmsRelationEndPointReflector),
                RelationEndPointReflector.CreateRelationEndPointReflector(
                    ClassDefinitionObjectMother.CreateClassDefinition(classType: type),
                    propertyInfo,
                    Configuration.NameResolver,
                    PropertyMetadataProvider,
                    DomainModelConstraintProviderStub));
        }
Beispiel #3
0
        public IRelationEndPointDefinition CreateRelationEndPointDefinition(ClassDefinition classDefinition, IPropertyInformation propertyInfo)
        {
            ArgumentUtility.CheckNotNull("classDefinition", classDefinition);
            ArgumentUtility.CheckNotNull("propertyInfo", propertyInfo);

            var relationEndPointReflector = RelationEndPointReflector.CreateRelationEndPointReflector(
                classDefinition,
                propertyInfo,
                _nameResolver,
                _propertyMetadataProvider,
                _domainModelConstraintProvider);

            return(relationEndPointReflector.GetMetadata());
        }
Beispiel #4
0
        public void GetMetadata_NonVirtualEndPoint_PropertyTypeIsNotObjectID()
        {
            var classDefinition    = ClassDefinitionObjectMother.CreateClassDefinitionWithMixins(typeof(ClassWithRealRelationEndPoints));
            var propertyDefinition =
                PropertyDefinitionObjectMother.CreateForFakePropertyInfo(classDefinition, "Unidirectional", typeof(string));

            classDefinition.SetPropertyDefinitions(new PropertyDefinitionCollection(new[] { propertyDefinition }, true));

            var mappingNameResolverMock = MockRepository.GenerateStub <IMemberInformationNameResolver>();

            mappingNameResolverMock.Stub(mock => mock.GetPropertyName(propertyDefinition.PropertyInfo)).Return(propertyDefinition.PropertyName);

            var relationEndPointReflector = RelationEndPointReflector.CreateRelationEndPointReflector(
                classDefinition,
                propertyDefinition.PropertyInfo,
                mappingNameResolverMock,
                PropertyMetadataProvider,
                DomainModelConstraintProviderStub);

            var result = relationEndPointReflector.GetMetadata();

            Assert.That(result, Is.TypeOf(typeof(TypeNotObjectIDRelationEndPointDefinition)));
        }