public void GetMetadata_ForBaseClass() { DomainModelConstraintProviderStub .Stub(stub => stub.IsNullable(Arg <IPropertyInformation> .Matches(pi => pi.Name == "BaseString"))) .Return(true); DomainModelConstraintProviderStub .Stub(stub => stub.IsNullable(Arg <IPropertyInformation> .Matches(pi => pi.Name == "BaseUnidirectionalOneToOne"))) .Return(true); DomainModelConstraintProviderStub .Stub(stub => stub.IsNullable(Arg <IPropertyInformation> .Matches(pi => pi.Name == "BasePrivateUnidirectionalOneToOne"))) .Return(true); DomainModelConstraintProviderStub .Stub(stub => stub.IsNullable(Arg <IPropertyInformation> .Matches(pi => pi.Name == "String"))) .Return(true); DomainModelConstraintProviderStub .Stub(stub => stub.IsNullable(Arg <IPropertyInformation> .Matches(pi => pi.Name == "UnidirectionalOneToOne"))) .Return(true); DomainModelConstraintProviderStub .Stub(stub => stub.IsNullable(Arg <IPropertyInformation> .Matches(pi => pi.Name == "PrivateString"))) .Return(true); ClassIDProviderStub.Stub(stub => stub.GetClassID(typeof(ClassWithDifferentProperties))).Return("ClassWithDifferentProperties"); var classReflector = CreateClassReflector(typeof(ClassWithDifferentProperties)); var expected = CreateClassWithDifferentPropertiesClassDefinition(); var actual = classReflector.GetMetadata(null); Assert.That(actual, Is.Not.Null); _classDefinitionChecker.Check(expected, actual); _endPointDefinitionChecker.Check(expected.MyRelationEndPointDefinitions, actual.MyRelationEndPointDefinitions, false); }
public void Get_WithDuplicateAssembly() { var assembly = GetType().Assembly; var expectedMappingReflector = MappingReflectorObjectMother.CreateMappingReflector(BaseConfiguration.GetTypeDiscoveryService(assembly)); var expectedClassDefinitions = expectedMappingReflector.GetClassDefinitions().ToDictionary(cd => cd.ClassType); var expectedRelationDefinitions = expectedMappingReflector.GetRelationDefinitions(expectedClassDefinitions); var mappingReflector = MappingReflectorObjectMother.CreateMappingReflector(BaseConfiguration.GetTypeDiscoveryService(assembly, assembly)); var actualClassDefinitions = mappingReflector.GetClassDefinitions().ToDictionary(cd => cd.ClassType); var classDefinitionChecker = new ClassDefinitionChecker(); classDefinitionChecker.Check(expectedClassDefinitions.Values, actualClassDefinitions, false, false); var actualRelationDefinitions = mappingReflector.GetRelationDefinitions(actualClassDefinitions).ToDictionary(rd => rd.ID); var relationDefinitionChecker = new RelationDefinitionChecker(); relationDefinitionChecker.Check(expectedRelationDefinitions, actualRelationDefinitions, false); }