public void then_database_block_has_default_connection_string() { var configurationSourceModel = Container.Resolve <ConfigurationSourceModel>(); SectionViewModel databaseSection = configurationSourceModel.Sections.Where(x => x.SectionName == "connectionStrings").First(); ElementViewModel addedConnectionString = databaseSection.GetDescendentsOfType <ConnectionStringSettings>().FirstOrDefault(); string defaultDatabase = (string)databaseSection.Property("DefaultDatabase").Value; Assert.AreEqual(addedConnectionString.Property("Name").Value, defaultDatabase); }
protected override void Arrange() { base.Arrange(); var sourceModel = Container.Resolve<ConfigurationSourceModel>(); LoggingViewModel = sourceModel.AddSection(LoggingSettings.SectionName, LoggingSection); elementReferencesChanged = false; LoggingViewModel.ElementReferencesChanged += (sender, args) => elementReferencesChanged = true; defaultCacheManagerProperty = (ElementReferenceProperty)LoggingViewModel.Property("DefaultCategory"); defaultCacheManagerProperty.Initialize(null); }
protected override void Arrange() { base.Arrange(); var sourceModel = Container.Resolve <ConfigurationSourceModel>(); LoggingViewModel = sourceModel.AddSection(LoggingSettings.SectionName, LoggingSection); elementReferencesChanged = false; LoggingViewModel.ElementReferencesChanged += (sender, args) => elementReferencesChanged = true; defaultCacheManagerProperty = (ElementReferenceProperty)LoggingViewModel.Property("DefaultCategory"); defaultCacheManagerProperty.Initialize(null); }
protected override void Arrange() { base.Arrange(); var sourceModel = Container.Resolve<ConfigurationSourceModel>(); LoggingViewModel = sourceModel.AddSection(LoggingSettings.SectionName, LoggingSection); defaultCategoryProperty = (ElementReferenceProperty)LoggingViewModel.Property("DefaultCategory"); defaultCategoryProperty.Initialize(null); traceSource = LoggingViewModel.GetDescendentsOfType<TraceSourceData>().First(); defaultCacheManagerPropertyChangedListener = new PropertyChangedListener(defaultCategoryProperty); }
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); }
protected override void Arrange() { base.Arrange(); var sourceModel = Container.Resolve <ConfigurationSourceModel>(); LoggingViewModel = sourceModel.AddSection(LoggingSettings.SectionName, LoggingSection); defaultCategoryProperty = (ElementReferenceProperty)LoggingViewModel.Property("DefaultCategory"); defaultCategoryProperty.Initialize(null); traceSource = LoggingViewModel.GetDescendentsOfType <TraceSourceData>().First(); defaultCacheManagerPropertyChangedListener = new PropertyChangedListener(defaultCategoryProperty); }
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(); 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"; }
private void CreateNewPolicy() { var categories = GetCollectionOfType <NamedElementCollection <TraceSourceData> >(loggingSection); var category = categories.AddNewCollectionElement(typeof(TraceSourceData)); wizardData.LogCategory = (string)category.Property("Name").Value; if (loggingSectionIsNew) { loggingSection.Property("DefaultCategory").Value = category.Property("Name").Value; } var listenerReferences = GetCollectionOfType <NamedElementCollection <TraceListenerReferenceData> >(category); var listenerReference = listenerReferences.AddNewCollectionElement(typeof(TraceListenerReferenceData)); var listeners = GetCollectionOfType <NamedElementCollection <TraceListenerData> >(loggingSection); var databaseListener = listeners.AddNewCollectionElement(typeof(FormattedDatabaseTraceListenerData)); databaseListener.Property("DatabaseInstanceName").Value = wizardData.DatabaseName; databaseListener.Property("Formatter").Value = formatter.Property("Name").Value; listenerReference.Property("Name").Value = databaseListener.Property("Name").Value; }
protected override void Act() { sectionModel.Property("Name").Value = "NewName"; }
public void then_default_database_property_has_validation_warning() { Property defaultDatabaseProperty = connectionStringsSection.Property("DefaultDatabase"); Assert.AreEqual(1, defaultDatabaseProperty.ValidationResults.Where(x => x.IsWarning).Count()); }
public void then_scope_can_resolve() { Assert.AreEqual("ReferringTo", section.Property("ReferencingProperty").Value); }