Example #1
0
        public void AssertViewModelWorks()
        {
            var savedConfiguration = new SavedConfiguration();

            var vm = new SavedConfigurationDialogViewModel(this.dialogNavigationService.Object, this.pluginService.Object, savedConfiguration);

            vm.Name        = "adda";
            vm.Description = "dde";

            Assert.DoesNotThrowAsync(() => vm.OkCommand.ExecuteAsyncTask(null));
        }
Example #2
0
        /// <summary>
        /// Executes the <see cref="SaveMappingCommand"/>
        /// </summary>
        private void SaveMappingCommandExecute()
        {
            if (string.IsNullOrWhiteSpace(this.importMappingConfiguration.Name))
            {
                var saveDialog = new SavedConfigurationDialogViewModel <RequirementsModuleSettings>(
                    this.pluginSettingsService,
                    this.importMappingConfiguration,
                    ReqIfJsonConverterUtility.BuildConverters());

                this.dialogNavigationService.NavigateModal(saveDialog);
            }
            else
            {
                var settings = this.pluginSettingsService.Read <RequirementsModuleSettings>();

                var configurationToUpdateIndex = settings.SavedConfigurations.IndexOf(
                    settings.SavedConfigurations.Single(x => x.Id == this.importMappingConfiguration.Id));

                settings.SavedConfigurations[configurationToUpdateIndex] = this.importMappingConfiguration;

                this.pluginSettingsService.Write(settings, ReqIfJsonConverterUtility.BuildConverters());
            }
        }