protected override void Arrange()
        {
            base.Arrange();

            configurationSourceModel = Container.Resolve<ConfigurationSourceModel>();
            configurationSourceModel.AddSection(LoggingSettings.SectionName, new LoggingSettings());
        }
        ///<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 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);

        }
        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.Yes).Verifiable();

            configurationSourceModel = Container.Resolve<ConfigurationSourceModel>();
            configurationSourceModel.AddSection(LoggingSettings.SectionName, new LoggingSettings());
        }
        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>();
        }
        /// <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);
        }
        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();

            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_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 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();
            testreferencingSection = new TestReferencingSection();

            var locator = new Mock<ConfigurationSectionLocator>();
            locator.Setup(x => x.ConfigurationSectionNames).Returns(new string[] {"testReferencingSection"});
            Container.RegisterInstance(locator.Object);

            DesignDictionaryConfigurationSource source = new DesignDictionaryConfigurationSource();
            source.Add("testReferencingSection", testreferencingSection);

            configSource = Container.Resolve<ConfigurationSourceModel>();
            configSource.Load(source);

            section = configSource.Sections.Where(x => x.SectionName == "testReferencingSection").Single();
            section.Property("ReferencingProperty").Value = "ReferringTo";
        }
        protected override void Arrange()
        {
            base.Arrange();

            var locator = new Mock<ConfigurationSectionLocator>();
            locator.Setup(x => x.ConfigurationSectionNames).Returns(new[] { "testSection" });
            Container.RegisterInstance(locator.Object);

            var section = new MockSectionWithSingleChild();
            section.Children.Add(new TestHandlerDataWithChildren() { Name = "ParentOne" });
            TestHandlerDataWithChildren child = new TestHandlerDataWithChildren() { Name = "Parent Two" };
            child.Children.Add(new TestHandlerData() { Name = "One" });
            child.Children.Add(new TestHandlerData() { Name = "Two" });
            section.Children.Add(child);

            var source = new DesignDictionaryConfigurationSource();
            source.Add("testSection", section);

            SourceModel = Container.Resolve<ConfigurationSourceModel>();
            SourceModel.Load(source);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Initializes a new instance of <see cref="ApplicationViewModel"/>.
        /// </summary>
        /// <param name="uiService">The <see cref="IUIServiceWpf"/> that should be used to interact with the user.</param>
        /// <param name="sourceModel">The <see cref="ConfigurationSourceModel"/> that should be used to interact with the configuration schema.</param>
        /// <param name="lookup">The <see cref="ElementLookup"/> that should be used to look up <see cref="ElementViewModel"/> instances.</param>
        /// <param name="builder">The <see cref="IUnityContainer"/> instance that should be used to create view model instances with.</param>
        /// <param name="menuCommandService">The <see cref="MenuCommandService"/> that should be used to look up top-level <see cref="CommandModel"/> instances.</param>
        /// <param name="validationModel">The <see cref="ValidationModel"/> that should be used to add validation errors and warnings to.</param>
        public ApplicationViewModel(IUIServiceWpf uiService, ConfigurationSourceModel sourceModel, ElementLookup lookup,
                                    IUnityContainer builder, MenuCommandService menuCommandService,
                                    ValidationModel validationModel)
        {
            ValidationModel = validationModel;
            this.uiService = uiService;
            this.sourceModel = sourceModel;
            
            this.lookup = lookup;
            this.builder = builder;
            this.menuCommandService = menuCommandService;

            NewConfigurationCommand = new DelegateCommand(x => New());
            SaveConfigurationCommand = new DelegateCommand(x => Save());
            SaveAsConfigurationCommand = new DelegateCommand(x => SaveAs());
            OpenConfigurationCommand = new DelegateCommand(x => OpenConfigurationSource());
            ExitCommand = new DelegateCommand(x => Close());

            OpenEnvironmentCommand = new OpenEnvironmentConfigurationDeltaCommand(uiService, this);
            NewEnvironmentCommand = new DelegateCommand(x => NewEnvironment());
        }
        /// <summary>
        /// Initializes a new instance of <see cref="ApplicationViewModel"/>.
        /// </summary>
        /// <param name="uiService">The <see cref="IUIServiceWpf"/> that should be used to interact with the user.</param>
        /// <param name="sourceModel">The <see cref="ConfigurationSourceModel"/> that should be used to interact with the configuration schema.</param>
        /// <param name="lookup">The <see cref="ElementLookup"/> that should be used to look up <see cref="ElementViewModel"/> instances.</param>
        /// <param name="builder">The <see cref="IUnityContainer"/> instance that should be used to create view model instances with.</param>
        /// <param name="menuCommandService">The <see cref="MenuCommandService"/> that should be used to look up top-level <see cref="CommandModel"/> instances.</param>
        /// <param name="validationModel">The <see cref="ValidationModel"/> that should be used to add validation errors and warnings to.</param>
        /// <param name="profile">The <see cref="Profile"/> that should be used to filter UI elements based on the platform.</param>
        public ApplicationViewModel(IUIServiceWpf uiService, ConfigurationSourceModel sourceModel, ElementLookup lookup,
                                    IUnityContainer builder, MenuCommandService menuCommandService,
                                    ValidationModel validationModel, Profile profile)
        {
            ValidationModel = validationModel;
            this.uiService = uiService;
            this.sourceModel = sourceModel;

            this.lookup = lookup;
            this.builder = builder;
            this.menuCommandService = menuCommandService;
            this.profile = profile;

            NewConfigurationCommand = new DelegateCommand(x => New());
            SaveConfigurationCommand = new DelegateCommand(x => Save());
            SaveAsConfigurationCommand = new DelegateCommand(x => SaveAs());
            OpenConfigurationCommand = new DelegateCommand(x => OpenConfigurationSource());
            ExitCommand = new DelegateCommand(x => Close());

            var environmentCommandsEnabled = this.profile == null ? true : profile.EnvironmentCommandsEnabled;
            OpenEnvironmentCommand = new OpenEnvironmentConfigurationDeltaCommand(uiService, this, environmentCommandsEnabled);
            NewEnvironmentCommand = new DelegateCommand(x => NewEnvironment(), _ => environmentCommandsEnabled);
        }
 protected override void Arrange()
 {
     base.Arrange();
     sourceModel = 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>();

        }
 public DatabaseSectionBuilder(ConfigurationSourceModel sourceModel, SelectDatabaseData wizardData)
     : base(sourceModel)
 {
     this.wizardData = wizardData;
 }
 public LoggingSectionBuilder(ConfigurationSourceModel sourceModel, PickExceptionTypeData wizardData)
     : base(sourceModel)
 {
     this.wizardData = wizardData;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddTransientFaultHandlingBlockCommand"/> class. 
 /// </summary>
 /// <param name="configurationSourceModel">The ConfigurationSourceModel.</param>
 /// <param name="attribute">The AddApplicationBlockCommandAttribute.</param>
 /// <param name="uiService">The IUIServiceWpf.</param>
 public AddTransientFaultHandlingBlockCommand(ConfigurationSourceModel configurationSourceModel, AddApplicationBlockCommandAttribute attribute, IUIServiceWpf uiService)
     : base(configurationSourceModel, attribute, uiService)
 {
 }
 public ExceptionHandlingBuilder(ConfigurationSourceModel sourceModel, PickExceptionTypeData wizardData)
     : base(sourceModel)
 {
     this.wizardData = wizardData;
 }
 public DatabaseConfigurationVerifier(ConfigurationSourceModel model)
 {
     this.model = model;
 }
        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();
        }