Beispiel #1
0
        public void SelectString_WithPathToNonExistentItem_ThrowsNullReferenceException()
        {
            string xml =
                $@"<testElement>123</testElement>";
            string path = "nonExistent";

            XMLElement element = new XMLElement(XElement.Parse(xml));

            Assert.Throws <NullReferenceException>(() => element.SelectString(path));
        }
Beispiel #2
0
        public void SelectString_WithPathToString_ReturnsThatString()
        {
            string expected = "testString";
            string xml      =
                $@"<testElement>{ expected }</testElement>";

            string path = "/";

            XMLElement element = new XMLElement(XElement.Parse(xml));

            var actual = element.SelectString(path);

            Assert.That(actual, Is.EqualTo(expected));
        }