[Test] // GetLineNumber (XmlReader) public void GetLineNumber1() { string xmlfile = Path.Combine(foldername, "test.xml"); XmlDocument doc = new XmlDocument(); doc.AppendChild(doc.CreateElement("test")); doc.Save(xmlfile); using (XmlReader reader = new XmlTextReader(xmlfile)) { int line = ConfigurationErrorsException.GetLineNumber(reader); Assert.AreEqual(0, line, "#1"); } using (XmlErrorReader reader = new XmlErrorReader(xmlfile)) { int line = ConfigurationErrorsException.GetLineNumber(reader); Assert.AreEqual(666, line, "#1"); } }
[Fact] // GetLineNumber (XmlReader) public void GetLineNumber1() { using (var temp = new TempDirectory()) { string xmlfile = Path.Combine(temp.Path, "test.xml"); XmlDocument doc = new XmlDocument(); doc.AppendChild(doc.CreateElement("test")); doc.Save(xmlfile); using (XmlReader reader = new XmlTextReader(xmlfile)) { int line = ConfigurationErrorsException.GetLineNumber(reader); Assert.Equal(0, line); } using (XmlErrorReader reader = new XmlErrorReader(xmlfile)) { int line = ConfigurationErrorsException.GetLineNumber(reader); Assert.Equal(666, line); } } }
[Test] // GetLineNumber (XmlReader) public void GetLineNumber1 () { string xmlfile = Path.Combine (foldername, "test.xml"); XmlDocument doc = new XmlDocument (); doc.AppendChild (doc.CreateElement ("test")); doc.Save (xmlfile); using (XmlReader reader = new XmlTextReader (xmlfile)) { int line = ConfigurationErrorsException.GetLineNumber (reader); Assert.AreEqual (0, line, "#1"); } using (XmlErrorReader reader = new XmlErrorReader (xmlfile)) { int line = ConfigurationErrorsException.GetLineNumber (reader); Assert.AreEqual (666, line, "#1"); } }