예제 #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 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);
        }