Exemplo n.º 1
0
        public void SelectInt_WithPathToNonInt_ThrowsFormatException()
        {
            string xml =
                $@"<testElement>dsasdsa</testElement>";
            string path = "/";

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

            Assert.Throws <FormatException>(() => element.SelectInt(path));
        }
Exemplo n.º 2
0
        public void SelectInt_WithPathToNonExistentItem_ThrowsNullReferenceException()
        {
            string xml =
                $@"<testElement>dsasdsa</testElement>";
            string path = "nonExistent";

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

            Assert.Throws <NullReferenceException>(() => element.SelectInt(path));
        }
Exemplo n.º 3
0
        public void SelectInt_WithPathToInt_ReturnsThatInt()
        {
            int    expected = 1579;
            string xml      =
                $@"<testElement>{ expected }</testElement>";

            string path = "/";

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

            var actual = element.SelectInt(path);

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