protected override void LoadDialogExtention()
 {
     //if we do not yet have connections added to the package settings
     //then lets add the active connection to the settings as the active connection
     if (SettingsObject.Connections == null ||
         !SettingsObject.Connections.Any())
     {
         try
         {
             var savedConnection = SavedXrmRecordConfiguration.CreateNew(XrmRecordService.XrmRecordConfiguration);
             savedConnection.Active     = true;
             SettingsObject.Connections = new[] { savedConnection };
         }
         catch (Exception)
         {
             //No matter if this happens user may just add it in anyway
         }
     }
     if (VisualStudioService != null && string.IsNullOrWhiteSpace(SettingsObject.SolutionObjectPrefix))
     {
         var solutionName = VisualStudioService.GetSolutionName();
         if (!string.IsNullOrWhiteSpace(solutionName))
         {
             SettingsObject.SolutionObjectPrefix = solutionName.Split('.').First();
         }
     }
     StartNextAction();
 }
        public void VsixRefreshConnectionDialogTest()
        {
            var xrmConfiguration       = new InterfaceMapperFor <IXrmConfiguration, XrmConfiguration>().Map(XrmConfiguration);
            var xrmRecordConfiguration = SavedXrmRecordConfiguration.CreateNew(new XrmConfigurationMapper().Map(xrmConfiguration));
            var dialog = new ConnectionEntryDialog(CreateDialogController(), xrmRecordConfiguration, VisualStudioService, true);

            dialog.Controller.BeginDialog();

            var entryViewModel = (ObjectEntryViewModel)dialog.Controller.UiItems.First();

            Assert.IsTrue(entryViewModel.Validate());
            entryViewModel.OnSave();
        }
        public XrmPackageSettings GetTestPackageSettings()
        {
            if (_testPackageSettings == null)
            {
                var xrmConfiguration       = new InterfaceMapperFor <IXrmConfiguration, XrmConfiguration>().Map(XrmConfiguration);
                var xrmRecordConfiguration = new XrmConfigurationMapper().Map(xrmConfiguration);
                var savedConnection        = SavedXrmRecordConfiguration.CreateNew(xrmRecordConfiguration);

                var testSolution    = ReCreateTestSolution();
                var packageSettings = new XrmPackageSettings();
                PopulateObject(packageSettings);
                packageSettings.AddToSolution = true;
                packageSettings.Solution      = testSolution.ToLookup();
                packageSettings.Connections   = new SavedXrmRecordConfiguration[] { savedConnection };
                _testPackageSettings          = packageSettings;
            }
            return(_testPackageSettings);
        }
 protected override void LoadDialogExtention()
 {
     //if we do not yet have connections added to the package settings
     //then lets add the active connection to the settings as the active connection
     if (SettingsObject.Connections == null ||
         !SettingsObject.Connections.Any())
     {
         try
         {
             var savedConnection = SavedXrmRecordConfiguration.CreateNew(XrmRecordService.XrmRecordConfiguration);
             savedConnection.Active     = true;
             SettingsObject.Connections = new[] { savedConnection };
         }
         catch (Exception)
         {
             //No matter if this happens user may just add it in anyway
         }
     }
     StartNextAction();
 }