public void Check_node_exists() { rootNode.AppendChild(doc.CreateElement("article")); dynamic config = new DynamicConfigSection(rootNode); Assert.IsNotNull(config.Article); }
public void Constcuts() { dynamic config = null; Assert.DoesNotThrow(() => { config = new DynamicConfigSection(rootNode); }); Assert.IsNotNull(config); }
public void Throws_attribute_not_found_exception_when_no_matching_attribute_exists() { rootNode.AppendChild(doc.CreateElement("article")); dynamic config = new DynamicConfigSection(rootNode); Assert.Throws<AttributeNotFoundException>(() => { var attr = config.Article.title; }); }
public void Does_not_throw_argument_not_found_exception_when_attribute_exists() { var articleNode = doc.CreateElement("article"); articleNode.Attributes.Append(doc.CreateAttribute("title")); rootNode.AppendChild(articleNode); dynamic config = new DynamicConfigSection(rootNode); Assert.DoesNotThrow(() => { var attr = config.Article.title; }); }
public DynamicConfiguration(string sectionName, Assembly configuringAssembly) { config = ConfigurationManager.GetSection(sectionName) as DynamicConfigSection; config.SetAssemblyWithConfigTypes(configuringAssembly); }