protected override void Arrange() { base.Arrange(); var resources = new ResourceHelper <ConfigFileLocator>(); resources.DumpResourceFileToDisk("empty.config"); var applicationViewModel = Container.Resolve <ApplicationViewModel>(); ConfigurationSourceModel sourceModel = applicationViewModel.CurrentConfigurationSource; applicationViewModel.NewEnvironment(); EhabModel = sourceModel.AddSection(ExceptionHandlingSettings.SectionName, Section); EnvironmentViewModel = applicationViewModel.Environments.First(); EnvironmentSection = (EnvironmentalOverridesSection)EnvironmentViewModel.ConfigurationElement; ((EnvironmentSourceViewModel)EnvironmentViewModel).EnvironmentConfigurationFile = "empty.config"; ((EnvironmentSourceViewModel)EnvironmentViewModel).EnvironmentDeltaFile = "empty.config"; WrapHandler = EhabModel.DescendentElements().Where(x => x.ConfigurationType == typeof(WrapHandlerData)).First(); MainExceptionMessage = WrapHandler.Property("ExceptionMessage"); MainExceptionMessage.Value = "Main Value"; OverridesProperty = WrapHandler.Properties.Where(x => x.PropertyName.StartsWith("Overrides")).First(); OverriddenExceptionMessage = OverridesProperty.ChildProperties.Where(x => x.PropertyName == "ExceptionMessage").First(); }
public SaveMergedEnvironmentConfigurationCommand(IUIServiceWpf uiService, ConfigurationSourceModel configurationSource, IApplicationModel application, ElementViewModel overridesViewModel) : base(uiService) { this.configurationSource = configurationSource; this.application = application; this.overridesViewModel = (EnvironmentSourceViewModel)overridesViewModel; }
///<summary> /// Initializes a new instance of <see cref="SelectDatabaseStep"/>. ///</summary> ///<param name="serviceProvider">The service provider to use for service location.</param> ///<param name="sourceModel">The <see cref="ConfigurationSourceModel"/> to update on <see cref="WizardStep.Execute"/></param> ///<param name="validatorFactory">The factory creating new <see cref="Validator"/> instances.</param> ///<param name="elementLookup">The service for locating registered elements.</param> public SelectDatabaseStep(IServiceProvider serviceProvider, ConfigurationSourceModel sourceModel, IResolver <Validator> validatorFactory, ElementLookup elementLookup ) : base(serviceProvider, validatorFactory, elementLookup) { this.sourceModel = sourceModel; var name = AddReflectedProperty(wizardData, propertyName); PropertyList.Add(new AssociatedWizardProperty(serviceProvider, wizardData, TypeDescriptor.GetProperties(wizardData)[propertyConnectionString], validatorFactory, elementLookup, name)); PropertyList.Add(new AssociatedWizardProperty(serviceProvider, wizardData, TypeDescriptor.GetProperties(wizardData)[propertyProviderName], validatorFactory, elementLookup, name)); SetDefaultDatabase(elementLookup); }
protected override void Arrange() { base.Arrange(); configurationSourceModel = Container.Resolve <ConfigurationSourceModel>(); configurationSourceModel.AddSection(LoggingSettings.SectionName, new LoggingSettings()); }
protected override void Arrange() { targetFile = "empty.dconfig"; environmentConfigFile = "empty.config"; ResourceHelper <ConfigFileLocator> helper = new ResourceHelper <ConfigFileLocator>(); helper.DumpResourceFileToDisk(targetFile); helper.DumpResourceFileToDisk(environmentConfigFile); mainFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "any.config"); base.Arrange(); applicationModel = (ApplicationViewModel)Container.Resolve <IApplicationModel>(); applicationModel.ConfigurationFilePath = mainFile; ConfigurationSourceModel sourceModel = Container.Resolve <ConfigurationSourceModel>(); applicationModel.NewEnvironment(); applicationModel.Environments.First().EnvironmentDeltaFile = targetFile; applicationModel.Environments.First().EnvironmentConfigurationFile = environmentConfigFile; UIServiceMock.Setup(x => x.ShowFileDialog(It.IsAny <SaveFileDialog>())) .Callback(() => Assert.Fail()); UIServiceMock.Setup(x => x.ShowMessageWpf(It.IsRegex("overwrite", RegexOptions.None), It.IsAny <string>(), System.Windows.MessageBoxButton.OKCancel)) .Returns(MessageBoxResult.Yes) .Verifiable(); }
public void then_database_trace_listener_connects_to_selected_database() { ConfigurationSourceModel.Logging() .HasListener("Database Trace Listener") .OfConfigurationType <FormattedDatabaseTraceListenerData>() .WithProperty(x => x.DatabaseInstanceName == selectDatabaseStep.Name.Value.ToString()); }
public void then_database_connection_string_matches() { ConfigurationSourceModel .DatabaseConfiguration() .WithConnectionString(step.Name.Value.ToString()) .MatchesConnectionString(step.ConnectionString.Value.ToString()) .MatchesProvider(step.DatabaseProvider.Value.ToString()); }
/// <summary> /// Initializes a new instance of the <see cref="AddApplicationBlockCommand"/> class. /// </summary> /// <param name="configurationModel">The <see cref="ConfigurationSourceModel"/> instance that represents the configuration source that is currently edited.</param> /// <param name="commandAttribute">The <see cref="AddApplicationBlockCommandAttribute"/> that specifes metadata for this <see cref="AddApplicationBlockCommand"/> to be initialized with.</param> /// <param name="uiService"></param> public AddApplicationBlockCommand(ConfigurationSourceModel configurationModel, AddApplicationBlockCommandAttribute commandAttribute, IUIServiceWpf uiService) : base(commandAttribute, uiService) { this.configurationModel = configurationModel; INotifyCollectionChanged collectionChanged = configurationModel.Sections; collectionChanged.CollectionChanged += Sections_CollectionChanged; this.sectionName = commandAttribute.SectionName; this.configurationSectionType = commandAttribute.ConfigurationSectionType; }
protected override void Act() { configurationSourceModel = Container.Resolve <ConfigurationSourceModel>(); var loggingViewModel = configurationSourceModel.AddSection(LoggingSettings.SectionName, LoggingSection); var tracelistenersCollection = loggingViewModel.GetDescendentsOfType <TraceListenerDataCollection>().First(); var addDBtracelinerCommand = tracelistenersCollection.Commands.First().ChildCommands.Where(x => x.Title == "Add Database Trace Listener").First(); addDBtracelinerCommand.Execute(null); }
public LoggingVerifier(ConfigurationSourceModel model) { this.model = model; currentSection = model.Sections.Where(x => x.ConfigurationType == typeof(LoggingSettings)).FirstOrDefault(); Assert.IsNotNull(currentSection, "Could not locate LoggingSettings in ConfigurationSourceModel"); }
protected override void Arrange() { base.Arrange(); configurationSource = new DesignDictionaryConfigurationSource(); configurationSource.Add(UnityConfigurationSection.SectionName, new UnityConfigurationSection()); Container.RegisterInstance(new Mock <IAssemblyDiscoveryService>().Object); configurationSourceModel = Container.Resolve <ConfigurationSourceModel>(); }
protected override void Arrange() { base.Arrange(); ConfigurationSourceModel sourceModel = Container.Resolve<ConfigurationSourceModel>(); sourceModel.New(); var loggingSection = SectionViewModel.CreateSection(Container, LoggingSettings.SectionName, base.LoggingSection); DiagnosticsTraceListner = loggingSection.GetDescendentsOfType<SystemDiagnosticsTraceListenerData>().First(); }
public void then_setting_property_makes_ui_dirty() { ConfigurationSourceModel sourceModel = Container.Resolve <ConfigurationSourceModel>(); var connectionStringSection = sourceModel.Sections.Where(x => x.SectionName == "connectionStrings").First(); var defaultConnectionProperty = connectionStringSection.Properties.First(); defaultConnectionProperty.Value = "new value"; Assert.IsTrue(ApplicationModel.IsDirty); }
protected override void Arrange() { base.Arrange(); UIServiceMock.Setup(x => x.ShowMessageWpf(It.IsAny <string>(), It.IsAny <string>(), It.Is <MessageBoxButton>(b => b == MessageBoxButton.YesNo))) .Returns(MessageBoxResult.No).Verifiable(); configurationSourceModel = Container.Resolve <ConfigurationSourceModel>(); configurationSourceModel.AddSection(LoggingSettings.SectionName, new LoggingSettings()); }
protected override void Arrange() { base.Arrange(); configurationSource = Container.Resolve <ConfigurationSourceModel>(); command = Container.Resolve <AddInstrumentationBlockCommand>( new ParameterOverride("commandAttribute", new AddApplicationBlockCommandAttribute( InstrumentationConfigurationSection.SectionName, typeof(InstrumentationConfigurationSection)))); }
/// <summary> /// Initializes an instance of <see cref="PickExceptionStep"/>. /// </summary> /// <param name="serviceProvider"></param> /// <param name="sourceModel"></param> /// <param name="validatorFactory"></param> /// <param name="elementLookup"></param> public PickExceptionStep(IServiceProvider serviceProvider, ConfigurationSourceModel sourceModel, IResolver <Validator> validatorFactory, ElementLookup elementLookup ) : base(serviceProvider, validatorFactory, elementLookup) { this.sourceModel = sourceModel; AddReflectedProperty(wizardData, propertyExceptionType); AddReflectedProperty(wizardData, propertyPolicy); }
public void then_configuration_contains_trace_source_configuration() { ConfigurationSourceModel.Logging() .HasCategory("Category") .WithListenerOfType <FormattedDatabaseTraceListenerData>("Database Trace Listener"); ConfigurationSourceModel.Logging() .HasListener("Database Trace Listener") .OfConfigurationType <FormattedDatabaseTraceListenerData>() .WithProperty(x => x.DatabaseInstanceName == step.ReferencedDatabaseName) .WithProperty(x => x.Formatter == "Text Formatter"); }
protected override void Arrange() { base.Arrange(); sourceModel = Container.Resolve <ConfigurationSourceModel>(); sourceModel.AddSection(LoggingSettings.SectionName, LoggingSection); var loggingSectionViewModel = sourceModel.Sections.Where(x => typeof(LoggingSettings) == x.ConfigurationType).First(); weakReferenceList = loggingSectionViewModel.DescendentElements().Union(new[] { loggingSectionViewModel }) .Select(x => new WeakReference(x)).ToArray(); }
protected override void Arrange() { base.Arrange(); var source = new DesignDictionaryConfigurationSource(); new TestConfigurationBuilder().AddLoggingSettings().Build(source); ConfigurationSourceModel.Load(source); LoggingSection = ConfigurationSourceModel.Sections.Where(x => x.ConfigurationType == typeof(LoggingSettings)).Single(); }
public void then_removed_sections_are_removed_when_saving() { ConfigurationSourceModel sourceModel = Container.Resolve <ConfigurationSourceModel>(); var cachingSettings = sourceModel.Sections.Where(x => x.ConfigurationType == typeof(CacheManagerSettings)).First(); cachingSettings.Delete(); ApplicationModel.Save(); FileConfigurationSource source = new FileConfigurationSource(TestConfigurationFilePath); Assert.IsNull(source.GetSection(CacheManagerSettings.SectionName)); }
protected override void Arrange() { base.Arrange(); configurationModel = Container.Resolve <ConfigurationSourceModel>(); AddApplicationBlockCommandAttribute attribute = new AddApplicationBlockCommandAttribute("appSettings", typeof(AppSettingsSection)); addBlockCommand = Container.Resolve <AddApplicationBlockCommand>( new DependencyOverride <ConfigurationSourceModel>(configurationModel), new DependencyOverride <AddApplicationBlockCommandAttribute>(attribute)); executeChagnedListener = new CanExecuteChangedListener(); executeChagnedListener.Add(addBlockCommand); }
protected override void Arrange() { base.Arrange(); applicationModelMock = new Mock <IApplicationModel>(); Container.RegisterInstance <IApplicationModel>(applicationModelMock.Object); addApplicationBlockCommand = Container.Resolve <AddApplicationBlockCommand>( new DependencyOverride <AddApplicationBlockCommandAttribute>( new AddApplicationBlockCommandAttribute(LoggingSettings.SectionName, typeof(LoggingSettings)))); configurationSourceModel = Container.Resolve <ConfigurationSourceModel>(); }
protected override void Arrange() { base.Arrange(); var resources = new ResourceHelper <ConfigFileLocator>(); resources.DumpResourceFileToDisk("configurationsource_main.config"); resources.DumpResourceFileToDisk("configurationsource_satellite.config"); var mainConfigFilePath = Path.Combine(Environment.CurrentDirectory, "configurationsource_main.config"); designSource = new DesignConfigurationSource(mainConfigFilePath); configurationSourceModel = Container.Resolve <ConfigurationSourceModel>(); }
protected override void Act() { UIServiceMock.Setup(x => x.ShowFileDialog(It.IsAny <FileDialog>())).Returns(new FileDialogResult { DialogResult = true, FileName = TestConfigurationFilePath }); UIServiceMock.Setup(x => x.ShowWindow(It.IsAny <Window>())); ApplicationModel.OpenConfigurationSource(); Assert.IsFalse(ApplicationModel.IsDirty); ApplicationModelChangedListener.ChangedProperties.Clear(); ConfigurationSourceModel sourceModel = Container.Resolve <ConfigurationSourceModel>(); sourceModel.AddSection("my section", new ConnectionStringsSection()); }
protected override void Arrange() { base.Arrange(); var resources = new ResourceHelper <ConfigFileLocator>(); resources.DumpResourceFileToDisk("configurationsource_main_with_missing.config"); designSource = new DesignConfigurationSource("configurationsource_main_with_missing.config"); configurationSourceModel = Container.Resolve <ConfigurationSourceModel>(); UIServiceMock.Setup(x => x.ShowWindow(It.IsAny <Window>())); UIServiceMock.Setup( x => x.ShowMessageWpf(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <MessageBoxButton>())) .Returns(MessageBoxResult.OK).Verifiable("Message not invoked"); }
protected override void Arrange() { base.Arrange(); var resources = new ResourceHelper <ConfigFileLocator>(); resources.DumpResourceFileToDisk("configurationsource_with_invalid_satellite.config"); resources.DumpResourceFileToDisk("configurationsource_invalid_satellite.config"); designSource = new DesignConfigurationSource("configurationsource_with_invalid_satellite.config"); configurationSourceModel = Container.Resolve <ConfigurationSourceModel>(); UIServiceMock.Setup(x => x.ShowWindow(It.IsAny <Window>())); UIServiceMock.Setup( x => x.ShowError(It.IsAny <Exception>(), It.IsAny <string>())).Verifiable(); }
protected override void Arrange() { base.Arrange(); HostAdapter = new SingleHierarchyConfigurationUIHostAdapter(new HostAdapterConfiguration(AppDomain.CurrentDomain.BaseDirectory), null); ConfigurationSourceModel sourceModel = (ConfigurationSourceModel)HostAdapter.GetService(typeof(ConfigurationSourceModel)); sourceModel.AddSection(CacheManagerSettings.SectionName, new CacheManagerSettings { DefaultCacheManager = "Cache Manager", CacheManagers = { { new CacheManagerData { Name = "Cache Manager" } } }, BackingStores = { { new CustomCacheStorageData("name", "custom store type") } } }); CachingViewModel = sourceModel.Sections.Single(); CacheManager = CachingViewModel.GetDescendentsOfType <CacheManagerData>().First(); }
protected override void Arrange() { base.Arrange(); var builder = new TestConfigurationBuilder(); configSource = new DesignDictionaryConfigurationSource(); builder.AddExceptionSettings() .Build(configSource); var mockLocator = new Mock <ConfigurationSectionLocator>(); mockLocator.Setup(x => x.ConfigurationSectionNames).Returns(new[] { ExceptionHandlingSettings.SectionName }); Container.RegisterInstance <ConfigurationSectionLocator>(mockLocator.Object); configurationSourceViewModel = Container.Resolve <ConfigurationSourceModel>(); }
protected override void Arrange() { base.Arrange(); ConfigurationSourceModel sourceModel = Container.Resolve <ConfigurationSourceModel>(); sourceModel.AddSection(ConfigurationSourceSection.SectionName, new ConfigurationSourceSection() { SelectedSource = "file source", Sources = { { new FileConfigurationSourceElement("file source", ".\\config") } } }); exportMergedEnvironmentCommand = base.EnvironmentViewModel.Commands.OfType <SaveMergedEnvironmentConfigurationCommand>().First(); base.UIServiceMock.Setup(x => x.ShowMessageWpf(It.IsRegex("File Configuration Source"), It.IsAny <string>(), MessageBoxButton.OK)) .Returns(MessageBoxResult.OK) .Verifiable(); }
protected override void Arrange() { base.Arrange(); ConfigurationSourceModel sourceModel = Container.Resolve <ConfigurationSourceModel>(); var section = sourceModel.AddSection(ConfigurationSourceSection.SectionName, new ConfigurationSourceSection() { Sources = { { new FileConfigurationSourceElement("file1", "file1") }, { new FileConfigurationSourceElement("file2", "file1") }, { new SystemConfigurationSourceElement("system") } }, RedirectedSections = { { new RedirectedSectionElement() { Name = "redirect" } } } }); sourceProperty = (ElementReferenceProperty)section.GetDescendentsOfType <RedirectedSectionElement>().First().Property("SourceName"); }
public AddCachingBlockCommand(ConfigurationSourceModel configurationSourceModel, AddApplicationBlockCommandAttribute attribute, IUIServiceWpf uiService) : base(configurationSourceModel, attribute, uiService) { }
public AddInstrumentationBlockCommand(ConfigurationSourceModel configurationModel, AddApplicationBlockCommandAttribute commandAttribute, IUIServiceWpf uiService) : base(configurationModel, commandAttribute, uiService) { }