public void CreateForAllRelationEndPoints_ClassDefinitionWithoutBaseClassDefinition_MakeCollectionReadOnlyIsTrue()
        {
            _classDefinition.SetRelationEndPointDefinitions(new RelationEndPointDefinitionCollection(new[] { _endPoint1, _endPoint2 }, false));

            var endPoints = RelationEndPointDefinitionCollection.CreateForAllRelationEndPoints(_classDefinition, true);

            Assert.That(endPoints.Count, Is.EqualTo(2));
            Assert.That(endPoints.IsReadOnly, Is.True);
            Assert.That(endPoints[0], Is.SameAs(_endPoint1));
            Assert.That(endPoints[1], Is.SameAs(_endPoint2));
        }
        public void CreateForAllRelationEndPoints_ClassDefinitionWithBaseClassDefinition()
        {
            var baseClassDefinition     = ClassDefinitionObjectMother.CreateClassDefinition(classType: typeof(Company));
            var basedPropertyDefinition = PropertyDefinitionObjectMother.CreateForFakePropertyInfo_ObjectID(baseClassDefinition, "Property1");

            baseClassDefinition.SetPropertyDefinitions(new PropertyDefinitionCollection(new[] { basedPropertyDefinition }, true));
            var derivedClassDefinition    = ClassDefinitionObjectMother.CreateClassDefinition(classType: typeof(Partner), baseClass: baseClassDefinition);
            var derivedPropertyDefinition = PropertyDefinitionObjectMother.CreateForFakePropertyInfo_ObjectID(derivedClassDefinition, "Property2");

            derivedClassDefinition.SetPropertyDefinitions(new PropertyDefinitionCollection(new[] { derivedPropertyDefinition }, true));

            var endPoint1 = new RelationEndPointDefinition(basedPropertyDefinition, false);
            var endPoint2 = new RelationEndPointDefinition(derivedPropertyDefinition, false);

            baseClassDefinition.SetRelationEndPointDefinitions(new RelationEndPointDefinitionCollection(new[] { endPoint1 }, true));
            derivedClassDefinition.SetRelationEndPointDefinitions(new RelationEndPointDefinitionCollection(new[] { endPoint2 }, true));

            var endPoints = RelationEndPointDefinitionCollection.CreateForAllRelationEndPoints(derivedClassDefinition, true);

            Assert.That(endPoints.Count, Is.EqualTo(2));
            Assert.That(endPoints[0], Is.SameAs(endPoint2));
            Assert.That(endPoints[1], Is.SameAs(endPoint1));
        }