public void ProperDeserialization() { DefaultConfigurationStore store = new DefaultConfigurationStore(); XmlInterpreter interpreter = new XmlInterpreter(ConfigHelper.ResolveConfigPath("sample_config.xml")); interpreter.ProcessResource(interpreter.Source, store); Assert.AreEqual(2, store.GetFacilities().Length); Assert.AreEqual(2, store.GetComponents().Length); Assert.AreEqual(2, store.GetConfigurationForChildContainers().Length); IConfiguration config = store.GetFacilityConfiguration("testidengine"); IConfiguration childItem = config.Children["item"]; Assert.IsNotNull(childItem); Assert.AreEqual("value", childItem.Value); config = store.GetFacilityConfiguration("testidengine2"); Assert.IsNotNull(config); Assert.AreEqual("value within CDATA section", config.Value); config = store.GetComponentConfiguration("testidcomponent1"); childItem = config.Children["item"]; Assert.IsNotNull(childItem); Assert.AreEqual("value1", childItem.Value); config = store.GetComponentConfiguration("testidcomponent2"); childItem = config.Children["item"]; Assert.IsNotNull(childItem); Assert.AreEqual("value2", childItem.Value); config = store.GetChildContainerConfiguration("child1"); Assert.IsNotNull(config); Assert.AreEqual(config.Attributes["name"], "child1"); Assert.AreEqual("<configuration />", config.Value); config = store.GetChildContainerConfiguration("child2"); Assert.IsNotNull(config); Assert.AreEqual(config.Attributes["name"], "child2"); Assert.AreEqual("<configuration />", config.Value); }
public void ProperDeserialization() { var store = new DefaultConfigurationStore(); var interpreter = new XmlInterpreter(Xml.Embedded("sample_config_complex.xml")); IKernel kernel = new DefaultKernel(); interpreter.ProcessResource(interpreter.Source, store, kernel); Assert.AreEqual(2, store.GetFacilities().Length); Assert.AreEqual(2, store.GetComponents().Length); Assert.AreEqual(2, store.GetConfigurationForChildContainers().Length); var config = store.GetFacilityConfiguration(typeof(DummyFacility).FullName); var childItem = config.Children["item"]; Assert.IsNotNull(childItem); Assert.AreEqual("value", childItem.Value); config = store.GetFacilityConfiguration(typeof(HiperFacility).FullName); Assert.IsNotNull(config); Assert.AreEqual("value within CDATA section", config.Value); config = store.GetComponentConfiguration("testidcomponent1"); childItem = config.Children["item"]; Assert.IsNotNull(childItem); Assert.AreEqual("value1", childItem.Value); config = store.GetComponentConfiguration("testidcomponent2"); childItem = config.Children["item"]; Assert.IsNotNull(childItem); Assert.AreEqual("value2", childItem.Value); config = store.GetChildContainerConfiguration("child1"); Assert.IsNotNull(config); Assert.AreEqual(config.Attributes["name"], "child1"); Assert.AreEqual("<configuration />", config.Value); config = store.GetChildContainerConfiguration("child2"); Assert.IsNotNull(config); Assert.AreEqual(config.Attributes["name"], "child2"); Assert.AreEqual("<configuration />", config.Value); }