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); }
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); }
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); }
public void IsVirtualEndRelationEndpoint_BidirectionalOneToMany() { RdbmsRelationEndPointReflector relationEndPointReflector = CreateRelationEndPointReflector("BidirectionalOneToMany"); Assert.That(relationEndPointReflector.IsVirtualEndRelationEndpoint(), Is.False); }
public void IsVirtualEndRelationEndpoint_Unidirectional() { RdbmsRelationEndPointReflector relationEndPointReflector = CreateRelationEndPointReflector("Unidirectional"); Assert.That(relationEndPointReflector.IsVirtualEndRelationEndpoint(), Is.False); }