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(); } }
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."); } }
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(); } }
public void ClearMemory() { using (var systemUnderTest = new SchemaWizard()) { systemUnderTest.OrganizationService = ServiceMock.Object; systemUnderTest.MetadataService = MetadataServiceMock.Object; FluentActions.Invoking(() => systemUnderTest.ClearMemory()) .Should() .NotThrow(); } }
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(); } }
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(); } }
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(); } }
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); }
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(); } } }