예제 #1
0
        public void GetMetadata_ForMandatory()
        {
            DomainModelConstraintProviderStub
            .Stub(stub => stub.IsNullable(Arg <IPropertyInformation> .Matches(pi => pi.Name == "NotNullable")))
            .Return(false);

            RdbmsRelationEndPointReflector relationEndPointReflector = CreateRelationEndPointReflector("NotNullable");

            IRelationEndPointDefinition actual = relationEndPointReflector.GetMetadata();

            Assert.IsInstanceOf(typeof(RelationEndPointDefinition), actual);
            Assert.That(actual.IsMandatory, Is.True);
        }
예제 #2
0
        public void IsVirtualRelationEndPoint_UnidirectionalRelation()
        {
            var type         = typeof(ClassWithRealRelationEndPoints);
            var propertyInfo = PropertyInfoAdapter.Create(type.GetProperty("Unidirectional"));
            var relationEndPointReflector = new RdbmsRelationEndPointReflector(
                ClassDefinitionObjectMother.CreateClassDefinition(classType: type),
                propertyInfo,
                Configuration.NameResolver,
                PropertyMetadataProvider,
                DomainModelConstraintProviderStub);

            Assert.That(relationEndPointReflector.IsVirtualEndRelationEndpoint(), Is.False);
        }
예제 #3
0
        public void GetMetadata_BidirectionalOneToOne()
        {
            DomainModelConstraintProviderStub
            .Stub(stub => stub.IsNullable(Arg <IPropertyInformation> .Matches(pi => pi.Name == "BidirectionalOneToOne")))
            .Return(true);

            RdbmsRelationEndPointReflector relationEndPointReflector = CreateRelationEndPointReflector("BidirectionalOneToOne");

            IRelationEndPointDefinition actual = relationEndPointReflector.GetMetadata();

            Assert.IsInstanceOf(typeof(RelationEndPointDefinition), actual);
            RelationEndPointDefinition relationEndPointDefinition = (RelationEndPointDefinition)actual;

            Assert.That(relationEndPointDefinition.ClassDefinition, Is.SameAs(_classDefinition));
            Assert.That(relationEndPointDefinition.PropertyDefinition, Is.SameAs(GetPropertyDefinition("BidirectionalOneToOne")));
            Assert.That(relationEndPointDefinition.RelationDefinition, Is.Null);
        }
예제 #4
0
        public void IsVirtualEndRelationEndpoint_BidirectionalOneToMany()
        {
            RdbmsRelationEndPointReflector relationEndPointReflector = CreateRelationEndPointReflector("BidirectionalOneToMany");

            Assert.That(relationEndPointReflector.IsVirtualEndRelationEndpoint(), Is.False);
        }
예제 #5
0
        public void IsVirtualEndRelationEndpoint_Unidirectional()
        {
            RdbmsRelationEndPointReflector relationEndPointReflector = CreateRelationEndPointReflector("Unidirectional");

            Assert.That(relationEndPointReflector.IsVirtualEndRelationEndpoint(), Is.False);
        }