private void PopulateAttributes(string entityLogicalName, ListViewItem listViewSelectedItem, ServiceParameters serviceParameters) { if (!workingstate) { lvAttributes.Items.Clear(); chkAllAttributes.Checked = true; InitFilter(listViewSelectedItem); if (listViewSelectedItem != null) { using (var bwFill = new BackgroundWorker()) { bwFill.DoWork += (sender, e) => { var unmarkedattributes = Settings[organisationId.ToString()][this.entityLogicalName].UnmarkedAttributes; var controller = new AttributeController(); var attributes = controller.GetAttributeList(entityLogicalName, cbShowSystemAttributes.Checked, serviceParameters); e.Result = controller.ProcessAllAttributeMetadata(unmarkedattributes, attributes, entityLogicalName, entityAttributes); }; bwFill.RunWorkerCompleted += (sender, e) => { var controller = new ListController(); controller.OnPopulateCompletedAction(e, NotificationService, this, lvAttributes); ManageWorkingState(false); }; bwFill.RunWorkerAsync(); } } } }
public void GetAttributeList() { string entityLogicalName = "contact"; AttributeMetadata[] attributes = null; var entityMetadata = new EntityMetadata(); bool showSystemAttributes = true; var serviceParameters = GenerateMigratorParameters(); MetadataServiceMock.Setup(x => x.RetrieveEntities(It.IsAny <string>(), It.IsAny <IOrganizationService>(), It.IsAny <IExceptionService>())) .Returns(entityMetadata) .Verifiable(); attributes = systemUnderTest.GetAttributeList(entityLogicalName, showSystemAttributes, serviceParameters); attributes.Should().BeNull(); }