Наследование: IConfigurationSectionHandler
Пример #1
0
        public static IEnumerable <ConfigurationParser> FromApplicationConfig()
        {
            IList <XmlNode> appConfigNodes = StructureMapConfigurationSection.GetStructureMapConfiguration();

            foreach (XmlNode appConfigNode in appConfigNodes)
            {
                yield return(new ConfigurationParser(appConfigNode));
            }
        }
Пример #2
0
        public void SettingsFromAllParentConfigFilesShouldBeIncluded()
        {
            var configurationSection = new StructureMapConfigurationSection();

            XmlNode fromMachineConfig =
                createNodeFromText(@"<StructureMap><Assembly Name=""SomeAssembly""/></StructureMap>");
            XmlNode fromWebConfig =
                createNodeFromText(@"<StructureMap><Assembly Name=""AnotherAssembly""/></StructureMap>");

            IList<XmlNode> parentNodes = new List<XmlNode>();
            parentNodes.Add(fromMachineConfig);

            var effectiveConfig =
                configurationSection.Create(parentNodes, null, fromWebConfig) as IList<XmlNode>;

            Assert.IsNotNull(effectiveConfig, "A list of configuration nodes should have been returned.");
            Assert.AreEqual(2, effectiveConfig.Count, "Both configurations should have been returned.");
            Assert.AreEqual(fromMachineConfig, effectiveConfig[0]);
            Assert.AreEqual(fromWebConfig, effectiveConfig[1]);
        }