Esempio n. 1
0
        public void CollectCrmAttributesFields()
        {
            var entityLogicalName = "contact";

            var attributeSet = new HashSet <string>()
            {
                "contactId", "firstname", "lastname"
            };

            inputEntityAttributes.Add(entityLogicalName, attributeSet);
            var inputAttributeMapping = new AttributeTypeMapping();

            var entityMetadata = InstantiateEntityMetaData(entityLogicalName);

            InsertAttributeList(entityMetadata, new List <string> {
                "contactId", "firstname", "lastname"
            });

            var crmEntity = new Capgemini.Xrm.DataMigration.Model.CrmEntity
            {
                Name        = entityLogicalName,
                DisplayName = entityLogicalName
            };

            FluentActions.Invoking(() => systemUnderTest.CollectCrmAttributesFields(entityMetadata, crmEntity, inputEntityAttributes, inputAttributeMapping, NotificationServiceMock.Object))
            .Should()
            .NotThrow();

            crmEntity.CrmFields.Count.Should().Be(3);
        }
Esempio n. 2
0
        public void CollectCrmEntityRelationShipNoInputEntityRelationships()
        {
            var entityLogicalName = "contact";

            var entityMetadata = InstantiateEntityMetaData(entityLogicalName);

            InsertAttributeList(entityMetadata, new List <string> {
                "contactId", "firstname", "lastname"
            });

            var crmEntity = new Capgemini.Xrm.DataMigration.Model.CrmEntity();

            FluentActions.Invoking(() => systemUnderTest.CollectCrmEntityRelationShip(entityMetadata, crmEntity, inputEntityRelationships))
            .Should()
            .NotThrow();

            crmEntity.CrmRelationships.Count.Should().Be(0);
        }
Esempio n. 3
0
        public void CollectCrmEntityRelationShipWithInputEntityRelationships()
        {
            var entityLogicalName   = "contact";
            var intersectEntityName = "account_contact";

            var relationship = new ManyToManyRelationshipMetadata
            {
                Entity1LogicalName        = "account",
                Entity1IntersectAttribute = "accountid",
                IntersectEntityName       = intersectEntityName,
                Entity2LogicalName        = "contact",
                Entity2IntersectAttribute = "contactid",
                IsCustomizable            = new BooleanManagedProperty()
                {
                    Value = true
                }
            };

            var entityRelationshipSet = new HashSet <string>()
            {
                intersectEntityName
            };

            inputEntityRelationships.Add(entityLogicalName, entityRelationshipSet);

            var entityMetadata = InstantiateEntityMetaData(entityLogicalName);

            InsertAttributeList(entityMetadata, new List <string> {
                "contactId", "firstname", "lastname"
            });
            InsertManyToManyRelationshipMetadata(entityMetadata, relationship);

            var crmEntity = new Capgemini.Xrm.DataMigration.Model.CrmEntity();

            FluentActions.Invoking(() => systemUnderTest.CollectCrmEntityRelationShip(entityMetadata, crmEntity, inputEntityRelationships))
            .Should()
            .NotThrow();
            crmEntity.CrmRelationships.Count.Should().Be(1);
        }
Esempio n. 4
0
        public void StoreCrmEntityRelationShipData()
        {
            var entityLogicalName   = "contact";
            var intersectEntityName = "account_contact";

            var relationship = new ManyToManyRelationshipMetadata
            {
                Entity1LogicalName        = "account",
                Entity1IntersectAttribute = "accountid",
                IntersectEntityName       = intersectEntityName,
                Entity2LogicalName        = "contact",
                Entity2IntersectAttribute = "contactid",
                IsCustomizable            = new BooleanManagedProperty()
                {
                    Value = true
                }
            };

            var relationshipList = new List <Capgemini.Xrm.DataMigration.Model.CrmRelationship>();

            var crmEntity = new Capgemini.Xrm.DataMigration.Model.CrmEntity
            {
                Name        = entityLogicalName,
                DisplayName = entityLogicalName
            };

            FluentActions.Invoking(() => systemUnderTest.StoreCrmEntityRelationShipData(crmEntity, relationship, relationshipList))
            .Should()
            .NotThrow();

            relationshipList.Count.Should().Be(1);
            relationshipList[0].RelatedEntityName.Should().Be(relationship.IntersectEntityName);
            relationshipList[0].RelationshipName.Should().Be(relationship.IntersectEntityName);
            relationshipList[0].IsReflexive.Should().Be(relationship.IsCustomizable.Value);
            relationshipList[0].ManyToMany.Should().BeTrue();
        }