private IPropertyInformation EnsurePropertyDefinitionExisitsOnClassDefinition(
            ClassDefinition classDefinition,
            Type declaringType,
            string propertyName)
        {
            var propertyInfo =
                PropertyInfoAdapter.Create(declaringType.GetProperty(propertyName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance));
            var propertyReflector = new PropertyReflector(
                classDefinition,
                propertyInfo,
                new ReflectionBasedMemberInformationNameResolver(),
                PropertyMetadataProvider,
                DomainModelConstraintProviderStub);
            var propertyDefinition = propertyReflector.GetMetadata();

            if (!classDefinition.MyPropertyDefinitions.Contains(propertyDefinition.PropertyName))
            {
                var propertyDefinitions = new PropertyDefinitionCollection(classDefinition.MyPropertyDefinitions, false);
                propertyDefinitions.Add(propertyDefinition);
                PrivateInvoke.SetNonPublicField(classDefinition, "_propertyDefinitions", propertyDefinitions);
                var endPoints = new RelationEndPointDefinitionCollection(classDefinition.MyRelationEndPointDefinitions, false);
                endPoints.Add(MappingObjectFactory.CreateRelationEndPointDefinition(classDefinition, propertyInfo));
                PrivateInvoke.SetNonPublicField(classDefinition, "_relationEndPoints", endPoints);
            }

            return(propertyInfo);
        }
 public void Add()
 {
     _collection.Add(_endPoint1);
     Assert.That(_collection.Count, Is.EqualTo(1));
 }