public void CanCreate() { ConfigSectionResource csr = CreateConfigSectionResource("_config1.xml"); Assert.IsFalse(csr.Exists); Assert.IsNull(csr.File); // always null Assert.IsNull(csr.Uri); Assert.IsTrue(csr.Description.StartsWith("config [")); Assert.IsTrue(csr.Description.EndsWith("#objects]")); }
public void ThrowsIoExceptionIfConfigSectionDoesNotExist() { IResource res = new ConfigSectionResource(Guid.NewGuid().ToString()); try { Stream istm = res.InputStream; Assert.Fail("Did not receive expected IOException!"); } catch(IOException) { } }
public void ThrowsIoExceptionIfConfigSectionDoesNotExist() { IResource res = new ConfigSectionResource(Guid.NewGuid().ToString()); try { Stream istm = res.InputStream; Assert.Fail("Did not receive expected IOException!"); } catch (IOException) { } }
private ConfigSectionResource CreateConfigSectionResource(string filename) { ConfigXmlDocument xmlDoc = new ConfigXmlDocument(); Uri testUri = TestResourceLoader.GetUri(this, filename); xmlDoc.Load("test config section", testUri.AbsoluteUri); XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable); nsmgr.AddNamespace("od", "http://www.springframework.net"); XmlElement configElement = (XmlElement)xmlDoc.SelectSingleNode("//configuration/spring/od:objects", nsmgr); ConfigSectionResource csr = new ConfigSectionResource( configElement); return csr; }
private ConfigSectionResource CreateConfigSectionResource(string filename) { ConfigXmlDocument xmlDoc = new ConfigXmlDocument(); Uri testUri = TestResourceLoader.GetUri(this, filename); xmlDoc.Load("test config section", testUri.AbsoluteUri); XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable); nsmgr.AddNamespace("od", "http://www.springframework.net"); XmlElement configElement = (XmlElement)xmlDoc.SelectSingleNode("//configuration/spring/od:objects", nsmgr); ConfigSectionResource csr = new ConfigSectionResource(configElement); return(csr); }