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

            validator = new LogFormatterValidator();

            errors = new List <ValidationResult>();

            IConfigurationSource       source       = new DictionaryConfigurationSource();
            ConfigurationSourceBuilder sourceBuiler = new ConfigurationSourceBuilder();

            sourceBuiler.ConfigureExceptionHandling()
            .GivenPolicyWithName("policy")
            .ForExceptionType <Exception>()
            .LogToCategory("category")
            .UsingExceptionFormatter <BadImageFormatException>();

            sourceBuiler.UpdateConfigurationWithReplace(source);

            ExceptionHandlingSettings EhabSettings = (ExceptionHandlingSettings)source.GetSection(ExceptionHandlingSettings.SectionName);

            var sectionModel = SectionViewModel.CreateSection(Container, "Ehab Section", EhabSettings);

            properties = sectionModel.GetDescendentsOfType <LoggingExceptionHandlerData>().First().Properties;
        }
Esempio n. 2
0
        protected override void Act()
        {
            var sectionModel = SectionViewModel.CreateSection(Container, "mock section", SectionWithSimpleProperties);

            configurationElement = (ConfigurationElementWithSimpleProperties)sectionModel.ConfigurationElement;
            properties           = sectionModel.Properties.OfType <ElementProperty>();
        }
        protected override void Arrange()
        {
            base.Arrange();
            var section = new ValidationSettings()
            {
                Types =
                {
                    new ValidatedTypeReference(typeof(given_string_length_validator_with_lower_greater_than_upper))
                    {
                        Rulesets =
                        {
                            new ValidationRulesetData("ruleSet")
                            {
                                Validators =
                                {
                                    new AndCompositeValidatorData("AndComposite1")
                                    {
                                        Validators =
                                        {
                                            new StringLengthValidatorData()
                                            {
                                                LowerBound = 10, UpperBound = 0, LowerBoundType = Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeBoundaryType.Ignore
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };

            ValidationViewModel = SectionViewModel.CreateSection(Container, ValidationSettings.SectionName, section);
            Container.Resolve <ElementLookup>().AddSection(ValidationViewModel);
        }
        protected override void Arrange()
        {
            base.Arrange();

            Viewmodel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, Section);
            Handler   = (CollectionElementViewModel)Viewmodel.DescendentElements(x => typeof(ExceptionHandlerData).IsAssignableFrom(x.ConfigurationType)).First();
        }
        protected override void Arrange()
        {
            base.Arrange();

            sectionViewModel             = SectionViewModel.CreateSection(Container, "mocksection", new MockSectionWithUnnamedCollection());
            toggleSectionExpandedCommand = sectionViewModel.Commands.OfType <ToggleExpandedCommand>().First();
        }
        protected override void Arrange()
        {
            base.Arrange();

            sectionViewModel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, base.Section);
            this.Container.RegisterInstance(new Mock <IAssemblyDiscoveryService>().Object);
        }
        protected override void Arrange()
        {
            base.Arrange();

            LoggingSectionViewModel = SectionViewModel.CreateSection(Container, LoggingSettings.SectionName, base.LoggingSection);
            EmailTraceListener      = LoggingSectionViewModel.GetDescendentsOfType <EmailTraceListenerData>().First();
        }
        protected override void Arrange()
        {
            base.Arrange();

            var section = new ElementForValidation();

            sectionModel = SectionViewModel.CreateSection(Container, "mock section", section);
        }
        protected override void Arrange()
        {
            base.Arrange();

            var loggingSection = SectionViewModel.CreateSection(Container, LoggingSettings.SectionName, base.LoggingSection);

            TraceSource = loggingSection.GetDescendentsOfType <TraceSourceData>().First();
        }
        protected override void Act()
        {
            var section = new MockSectionWithSingleChild();

            section.Children.Add(new TestHandlerDataWithChildren());

            this.ViewModel = SectionViewModel.CreateSection(Container, "mock section", section);
        }
        protected override void Arrange()
        {
            base.Arrange();

            SectionWithDifferentCommands section = new SectionWithDifferentCommands();

            Viewmodel = SectionViewModel.CreateSection(Container, "SectionWithDifferentCommands", section);
        }
Esempio n. 12
0
        protected override void Arrange()
        {
            base.Arrange();

            var section = new MockSectionWithUnnamedCollection();

            this.ViewModel = SectionViewModel.CreateSection(Container, "mockSection", section);
        }
Esempio n. 13
0
        protected override void Arrange()
        {
            base.Arrange();

            var section = new MockSectionWithSingleChild();

            this.ViewModel = SectionViewModel.CreateSection(Container, "mock section", section);
        }
        protected override void Arrange()
        {
            base.Arrange();

            var section = new MockSectionWithMultipleChildCollections();

            BuildSection(section);
            ViewModel = SectionViewModel.CreateSection(Container, "name", section);
        }
Esempio n. 15
0
        protected override void Act()
        {
            Container.RegisterInstance <IWindowsFormsEditorService>(new Mock <IWindowsFormsEditorService>().Object);
            Container.RegisterInstance <IUIService>(new Mock <IUIService>().Object);

            var sectionModel = SectionViewModel.CreateSection(Container, "mockSection", new ConfigurationElementWithComponentModelEditor());

            properties = sectionModel.Properties;
        }
        protected override void Arrange()
        {
            base.Arrange();

            exceptionSettingsViewModel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, new ExceptionHandlingSettings());
            var exceptionPolicyContainer = exceptionSettingsViewModel.GetDescendentsOfType <NamedElementCollection <ExceptionPolicyData> >().First();

            addExceptionPolicyCommand = exceptionPolicyContainer.AddCommands.OfType <AddExceptionPolicyCommand>().First();
        }
Esempio n. 17
0
        protected override void Arrange()
        {
            base.Arrange();

            var lookup = Container.Resolve <ElementLookup>();

            sectionViewModel = SectionViewModel.CreateSection(Container, LoggingSettings.SectionName, LoggingSection);
            sectionViewModel.Initialize(new InitializeContext());
            lookup.AddSection(sectionViewModel);
        }
        protected override void Arrange()
        {
            base.Arrange();

            AppSettings = new AppSettingsSection();
            AppSettings.Settings.Add(new KeyValueConfigurationElement("Setting1", "Value1"));
            AppSettings.Settings.Add(new KeyValueConfigurationElement("Setting2", "Value2"));

            AppSettingsView = SectionViewModel.CreateSection(Container, "appSettings", AppSettings);
        }
Esempio n. 19
0
        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();
        }
        protected override void Arrange()
        {
            base.Arrange();

            var section = new ElementForValidation();

            sectionModel     = SectionViewModel.CreateSection(Container, "mock section", section);
            validationResult = new ElementValidationResult(sectionModel, "TestMessage", true);
            listener         = new PropertyChangedListener(validationResult);
        }
Esempio n. 21
0
        protected override void Arrange()
        {
            base.Arrange();

            var section          = new ConfigurationSectionWithANamedElementCollection();
            var sectionViewModel = SectionViewModel.CreateSection(base.Container, "sectionName", section);

            CollectionViewModel          = sectionViewModel.DescendentElements().OfType <ElementCollectionViewModel>().Single();
            AssemblyDiscoveryServiceMock = new Mock <IAssemblyDiscoveryService>();
        }
        protected override void Act()
        {
            Container.RegisterInstance <IWindowsFormsEditorService>(new Mock <IWindowsFormsEditorService>().Object);
            Container.RegisterInstance <IUIService>(new Mock <IUIService>().Object);

            var sectionModel = SectionViewModel.CreateSection(Container, "mock section", new ConfigurationElementWithComponentModelEditor());

            var originalPropertyDescriptor = TypeDescriptor.GetProperties(typeof(ConfigurationElementWithComponentModelEditor)).OfType <PropertyDescriptor>().Where(x => x.Name == "Prop3").First();

            property = sectionModel.CreateElementProperty(sectionModel, new PropertyDescriptorReturnEditor(originalPropertyDescriptor));
        }
        protected override void Arrange()
        {
            base.Arrange();

            exceptionHandlingViewModel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, base.ExceptionSettings);

            ElementLookup lookup = Container.Resolve <ElementLookup>();

            changeScopeForHandlers = lookup.CreateChangeScope(x => typeof(ExceptionHandlerData).IsAssignableFrom(x.ConfigurationType));

            changeScopeForHandlers.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(changeScopeForHandlers_CollectionChanged);
        }
        protected override void Arrange()
        {
            base.Arrange();

            var section = new ElementForValidation();

            var sectionModel = SectionViewModel.CreateSection(Container, "mock section", section);

            collectionElement =
                sectionModel.DescendentConfigurationsOfType <NamedElementCollection <TestNamedElement> >()
                .Where(x => x.Name == "ReferencedItems").OfType <ElementCollectionViewModel>().First();
        }
Esempio n. 25
0
        protected override void Arrange()
        {
            base.Arrange();
            this.Container.RegisterInstance <IAssemblyDiscoveryService>(new Mock <IAssemblyDiscoveryService>().Object);

            var cachingSettings      = new CacheManagerSettings();
            var cachingSettingsModel = SectionViewModel.CreateSection(Container, CacheManagerSettings.SectionName, cachingSettings);

            var cacheManagerCollection         = (ElementCollectionViewModel)cachingSettingsModel.GetDescendentsOfType <NameTypeConfigurationElementCollection <CacheManagerDataBase, CustomCacheManagerData> >().First();
            var cacheManagerCollectionCommands = cacheManagerCollection.Commands.SelectMany(x => x.ChildCommands);

            addCacheManagerCommand = cacheManagerCollectionCommands.OfType <AddCacheManagerCommand>().First();
        }
        protected override void Arrange()
        {
            base.Arrange();

            applicationModelMock = new Mock <IApplicationModel>();

            var section = SectionViewModel.CreateSection(Container, "appSettings", new AppSettingsSection());

            applicationModelMock.Setup(x => x.SetDirty()).Verifiable();

            Container.RegisterInstance <IApplicationModel>(applicationModelMock.Object);
            deleteCommand = Container.Resolve <DefaultDeleteCommandModel>(new DependencyOverride <ElementViewModel>(section));
        }
        protected override void Arrange()
        {
            base.Arrange();

            applicationModelMock = new Mock <IApplicationModel>();

            Container.RegisterInstance <IApplicationModel>(applicationModelMock.Object);

            var section = SectionViewModel.CreateSection(Container, "appSettings", new AppSettingsSection());

            addCommand = section.ChildElements.First().Commands.OfType <DefaultCollectionElementAddCommand>().First();

            applicationModelMock.Setup(x => x.SetDirty()).Verifiable();
        }
        protected override void Arrange()
        {
            base.Arrange();

            var section          = new Mocks.MockSectionWithMultipleChildCollections();
            var sectionViewModel = SectionViewModel.CreateSection(Container, "mockSection", section);

            polymorphicCollection = sectionViewModel.ChildElements
                                    .OfType <ElementCollectionViewModel>()
                                    .Where(
                c =>
                typeof(NameTypeConfigurationElementCollection <TestHandlerData, CustomTestHandlerData>).IsAssignableFrom
                    (c.ConfigurationType)).First();
        }
Esempio n. 29
0
        protected override void Arrange()
        {
            base.Arrange();

            ApplicationViewModel applicationModel = base.Container.Resolve <ApplicationViewModel>();

            applicationModel.ConfigurationFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "main.config");

            overridesModel = (EnvironmentSourceViewModel)SectionViewModel.CreateSection(Container, EnvironmentalOverridesSection.EnvironmentallyOverriddenProperties, new EnvironmentalOverridesSection
            {
                EnvironmentName = "environment"
            });
            overridesModel.EnvironmentDeltaFile = "non_rooted_environment.dconfig";
            targetFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, overridesModel.EnvironmentDeltaFile);
        }
Esempio n. 30
0
        protected override void Arrange()
        {
            base.Arrange();

            SectionWithReference = new SectionWithReference();
            SectionWithReference.ItemsCollection.Add(new NamedReferencedItem()
            {
                Name = "FirstItem"
            });

            SectionViewModel = SectionViewModel.CreateSection(Container, "testSection", SectionWithReference);

            ReferencingProperty = (ElementReferenceProperty)SectionViewModel.Property("DefaultItem");
            ReferencingProperty.Initialize(null);
        }