Esempio n. 1
0
        public void InitFilterWithListViewtag()
        {
            var entityLogicalName = "account";
            var entityMetadata    = new EntityMetadata
            {
                LogicalName = entityLogicalName,
                DisplayName = new Label
                {
                    UserLocalizedLabel = new LocalizedLabel {
                        Label = "Test"
                    }
                }
            };
            var settings = new Capgemini.Xrm.CdsDataMigratorLibrary.Core.Settings();

            using (var systemUnderTest = new SchemaWizard())
            {
                var entityitem = new System.Windows.Forms.ListViewItem
                {
                    Tag = entityMetadata
                };
                systemUnderTest.Settings = settings;

                systemUnderTest.OrganizationService = ServiceMock.Object;
                systemUnderTest.MetadataService     = MetadataServiceMock.Object;

                FluentActions.Invoking(() => systemUnderTest.InitFilter(entityitem))
                .Should()
                .NotThrow();
            }
        }
Esempio n. 2
0
        public void InitFilterWithListViewtagAndNoSettings()
        {
            var entityLogicalName = "account";
            var entityMetadata    = new EntityMetadata
            {
                LogicalName = entityLogicalName,
                DisplayName = new Label
                {
                    UserLocalizedLabel = new LocalizedLabel {
                        Label = "Test"
                    }
                }
            };

            using (var systemUnderTest = new SchemaWizard())
            {
                var entityitem = new System.Windows.Forms.ListViewItem
                {
                    Tag = entityMetadata
                };
                systemUnderTest.Settings = null;

                systemUnderTest.OrganizationService = ServiceMock.Object;
                systemUnderTest.MetadataService     = MetadataServiceMock.Object;

                FluentActions.Invoking(() => systemUnderTest.InitFilter(entityitem))
                .Should()
                .Throw <NullReferenceException>()
                .WithMessage("Object reference not set to an instance of an object.");
            }
        }
Esempio n. 3
0
        public void LoadSchemaFileWithValidPath()
        {
            string configFilename = "TestData\\testschemafile.xml";

            var entityLogicalName = "account";
            var entityMetadata    = new EntityMetadata
            {
                LogicalName = entityLogicalName,
                DisplayName = new Label
                {
                    UserLocalizedLabel = new LocalizedLabel {
                        Label = "Test"
                    }
                }
            };

            InsertAttributeList(entityMetadata, new List <string> {
                "contactattnoentity1"
            });

            var inputEntityAttributes = new Dictionary <string, HashSet <string> >();

            workingstate = true;

            using (var systemUnderTest = new SchemaWizard())
            {
                systemUnderTest.OrganizationService = ServiceMock.Object;
                systemUnderTest.MetadataService     = MetadataServiceMock.Object;
                systemUnderTest.NotificationService = NotificationServiceMock.Object;

                FluentActions.Invoking(() => systemUnderTest.LoadSchemaFile(configFilename, workingstate, NotificationServiceMock.Object, inputEntityAttributes, inputEntityRelationships))
                .Should()
                .NotThrow();
            }
        }
Esempio n. 4
0
        public void ClearMemory()
        {
            using (var systemUnderTest = new SchemaWizard())
            {
                systemUnderTest.OrganizationService = ServiceMock.Object;
                systemUnderTest.MetadataService     = MetadataServiceMock.Object;

                FluentActions.Invoking(() => systemUnderTest.ClearMemory())
                .Should()
                .NotThrow();
            }
        }
Esempio n. 5
0
        public void ManageWorkingStateSetWorkingStateToFalse()
        {
            using (var systemUnderTest = new SchemaWizard())
            {
                systemUnderTest.OrganizationService = ServiceMock.Object;
                systemUnderTest.MetadataService     = MetadataServiceMock.Object;
                systemUnderTest.NotificationService = NotificationServiceMock.Object;

                FluentActions.Invoking(() => systemUnderTest.ManageWorkingState(false))
                .Should()
                .NotThrow();
            }
        }
Esempio n. 6
0
        public void InitFilter()
        {
            using (var systemUnderTest = new SchemaWizard())
            {
                var entityitem = new System.Windows.Forms.ListViewItem();

                systemUnderTest.OrganizationService = ServiceMock.Object;
                systemUnderTest.MetadataService     = MetadataServiceMock.Object;

                FluentActions.Invoking(() => systemUnderTest.InitFilter(entityitem))
                .Should()
                .NotThrow();
            }
        }
Esempio n. 7
0
        public void OnConnectionUpdated()
        {
            string entityLogicalName = "account_contact";

            SetupMockObjects(entityLogicalName);

            using (var systemUnderTest = new SchemaWizard())
            {
                systemUnderTest.OrganizationService = ServiceMock.Object;
                systemUnderTest.MetadataService     = MetadataServiceMock.Object;

                FluentActions.Invoking(() => systemUnderTest.OnConnectionUpdated(Guid.NewGuid(), "TestOrg"))
                .Should()
                .NotThrow();
            }
        }
Esempio n. 8
0
        public void LoadSchemaFileWithEmptyExportConfigPath()
        {
            string schemaFilename        = string.Empty;
            var    inputEntityAttributes = new Dictionary <string, HashSet <string> >();

            NotificationServiceMock.Setup(x => x.DisplayFeedback(It.IsAny <string>()))
            .Verifiable();

            using (var systemUnderTest = new SchemaWizard())
            {
                systemUnderTest.OrganizationService = ServiceMock.Object;
                systemUnderTest.MetadataService     = MetadataServiceMock.Object;
                systemUnderTest.NotificationService = NotificationServiceMock.Object;

                FluentActions.Invoking(() => systemUnderTest.LoadSchemaFile(schemaFilename, workingstate, NotificationServiceMock.Object, inputEntityAttributes, inputEntityRelationships))
                .Should()
                .NotThrow();
            }

            NotificationServiceMock.Verify(x => x.DisplayFeedback(It.IsAny <string>()), Times.Never);
        }
Esempio n. 9
0
        public void HandleListViewEntitiesSelectedIndexChanged()
        {
            string           inputEntityLogicalName = "account";
            HashSet <string> inputSelectedEntity    = new HashSet <string>();

            using (var listView = new System.Windows.Forms.ListView())
            {
                var selectedItems = new System.Windows.Forms.ListView.SelectedListViewItemCollection(listView);

                using (var systemUnderTest = new SchemaWizard())
                {
                    systemUnderTest.OrganizationService = ServiceMock.Object;
                    systemUnderTest.MetadataService     = MetadataServiceMock.Object;

                    var serviceParameters = GenerateMigratorParameters();

                    FluentActions.Invoking(() => systemUnderTest.HandleListViewEntitiesSelectedIndexChanged(inputEntityRelationships, inputEntityLogicalName, inputSelectedEntity, selectedItems, serviceParameters))
                    .Should()
                    .NotThrow();
                }
            }
        }