public void CreateRelationEndPointDefinitionCollection()
        {
            var classDefinition    = ClassDefinitionObjectMother.CreateClassDefinition(classType: typeof(OrderTicket), baseClass: null);
            var propertyDefinition = PropertyDefinitionObjectMother.CreateForRealPropertyInfo(classDefinition, typeof(OrderTicket), "Order");

            classDefinition.SetPropertyDefinitions(new PropertyDefinitionCollection(new[] { propertyDefinition }, true));

            var result = _factory.CreateRelationEndPointDefinitionCollection(classDefinition);

            Assert.That(result.Count, Is.EqualTo(1));
            Assert.That(
                ((RelationEndPointDefinition)result[0]).PropertyName,
                Is.EqualTo("Remotion.Data.DomainObjects.UnitTests.Mapping.TestDomain.Integration.OrderTicket.Order"));
        }
        public void PropertyDefinitionsAreValidated()
        {
            var classDefinition    = ClassDefinitionObjectMother.CreateClassDefinition(classType: typeof(DerivedValidationDomainObjectClass));
            var propertyDefinition = PropertyDefinitionObjectMother.CreateForRealPropertyInfo(
                classDefinition, typeof(DerivedValidationDomainObjectClass), "PropertyWithStorageClassNone");

            classDefinition.SetPropertyDefinitions(new PropertyDefinitionCollection(new[] { propertyDefinition }, true));

            StubMockMappingLoaderWithValidation(new[] { classDefinition }, new RelationDefinition[0]);
            _mockRepository.ReplayAll();

            new MappingConfiguration(
                _mockMappingLoader,
                new PersistenceModelLoader(new StorageGroupBasedStorageProviderDefinitionFinder(DomainObjectsConfiguration.Current.Storage)));
        }
        public void CreateRelationDefinitionCollection()
        {
            var classDefinition    = ClassDefinitionObjectMother.CreateClassDefinitionWithMixins(typeof(OrderItem));
            var propertyDefinition = PropertyDefinitionObjectMother.CreateForRealPropertyInfo(classDefinition, typeof(OrderItem), "Order");
            var endPoint           = new RelationEndPointDefinition(propertyDefinition, false);

            classDefinition.SetPropertyDefinitions(new PropertyDefinitionCollection(new[] { propertyDefinition }, true));
            classDefinition.SetRelationEndPointDefinitions(new RelationEndPointDefinitionCollection(new[] { endPoint }, true));

            var result = _factory.CreateRelationDefinitionCollection(new[] { classDefinition }.ToDictionary(cd => cd.ClassType));

            Assert.That(result.Count(), Is.EqualTo(1));
            Assert.That(
                result.First().ID,
                Is.EqualTo(
                    "Remotion.Data.DomainObjects.UnitTests.Mapping.TestDomain.Integration.OrderItem:"
                    + "Remotion.Data.DomainObjects.UnitTests.Mapping.TestDomain.Integration.OrderItem.Order->"
                    + "Remotion.Data.DomainObjects.UnitTests.Mapping.TestDomain.Integration.Order.OrderItems"));
        }