public void LoadTextReaderStoresTextPosition()
 {
     ConfigXmlDocument xmlDoc = new ConfigXmlDocument();
     Stream istm = TestResourceLoader.GetStream( this, "_SampleConfig.xml" );
     xmlDoc.Load( "MYXML", new StreamReader(istm) );
     ITextPosition pos = ((ITextPosition)xmlDoc.SelectSingleNode("//property"));
     Assert.AreEqual("MYXML", pos.Filename);
     Assert.AreEqual(5, pos.LineNumber);
     Assert.AreEqual(14, pos.LinePosition);
 }
 public void LoadXmlStoresTextPosition()
 {
     ConfigXmlDocument xmlDoc = new ConfigXmlDocument();
     string xmlText = TestResourceLoader.GetText( this, "_SampleConfig.xml" );
     xmlDoc.LoadXml( "MYXML", xmlText );
     ITextPosition pos = ((ITextPosition)xmlDoc.SelectSingleNode("//property"));
     Assert.AreEqual("MYXML", pos.Filename);
     Assert.AreEqual(5, pos.LineNumber);
     Assert.AreEqual(14, pos.LinePosition);
 }
 public void LoadXmlStoresTextPosition()
 {
     ConfigXmlDocument xmlDoc = new ConfigXmlDocument();
     string xmlText = TestResourceLoader.GetText( this, "_SampleConfig.xml" );
     xmlDoc.LoadXml( "MYXML", xmlText );
     ITextPosition pos = ((ITextPosition)xmlDoc.SelectSingleNode("//property"));
     Assert.AreEqual("MYXML", pos.Filename);
     Assert.AreEqual(5, pos.LineNumber);
     Assert.AreEqual(14, pos.LinePosition);
 }
 public void LoadTextReaderStoresTextPosition()
 {
     ConfigXmlDocument xmlDoc = new ConfigXmlDocument();
     Stream istm = TestResourceLoader.GetStream( this, "_SampleConfig.xml" );
     xmlDoc.Load( "MYXML", new StreamReader(istm) );
     ITextPosition pos = ((ITextPosition)xmlDoc.SelectSingleNode("//property"));
     Assert.AreEqual("MYXML", pos.Filename);
     Assert.AreEqual(5, pos.LineNumber);
     Assert.AreEqual(14, pos.LinePosition);
 }
 public void CanConfigFilenameAndLine()
 {
     ConfigXmlDocument xmlDoc = new ConfigXmlDocument();
     Stream istm = TestResourceLoader.GetStream( this, "_SampleConfig.xml" );
     xmlDoc.Load( "MYXML", new StreamReader(istm) );
     XmlNode node = xmlDoc.SelectSingleNode("//property");
     Assert.AreEqual("MYXML", ConfigurationUtils.GetFileName(node) );
     Assert.AreEqual(5, ConfigurationUtils.GetLineNumber(node) );
     //Assert.AreEqual(14, pos.LinePosition); <- IConfigErrorInfo/IConfigXmlNode do not support LinePosition
 }
        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;
        }
 public void CanConfigFilenameAndLine()
 {
     ConfigXmlDocument xmlDoc = new ConfigXmlDocument();
     Stream istm = TestResourceLoader.GetStream( this, "_SampleConfig.xml" );
     xmlDoc.Load( "MYXML", new StreamReader(istm) );
     XmlNode node = xmlDoc.SelectSingleNode("//property");
     Assert.AreEqual("MYXML", ConfigurationUtils.GetFileName(node) );
     Assert.AreEqual(5, ConfigurationUtils.GetLineNumber(node) );
     //Assert.AreEqual(14, pos.LinePosition); <- IConfigErrorInfo/IConfigXmlNode do not support LinePosition
 }