コード例 #1
0
        public void Parse_WhenCalled_TagNameAndPositionExtracted()
        {
            var e = HtmlPathElement.Parse("table[2]");

            Assert.AreEqual("TABLE", e.TagName);
            Assert.AreEqual(2, e.Position);
        }
コード例 #2
0
        public void Ctor_WhenCalled_TagNameConvertedToUppperAndPositonSet()
        {
            var e = new HtmlPathElement("Tr", 3);

            Assert.That(e.TagName, Is.EqualTo("TR"));
            Assert.That(e.Position, Is.EqualTo(3));
        }
コード例 #3
0
ファイル: HtmlPathTests.cs プロジェクト: riyanhax/Maui
        public void ElementParse()
        {
            HtmlPathElement e = HtmlPathElement.Parse("table[2]");

            Assert.AreEqual("TABLE", e.TagName);
            Assert.AreEqual(2, e.Position);
            Assert.IsTrue(e.IsTableOrTBody);
        }
コード例 #4
0
ファイル: HtmlPathTests.cs プロジェクト: riyanhax/Maui
        public void SimpleElement()
        {
            HtmlPathElement e = new HtmlPathElement("Tr", 3);

            Assert.AreEqual("TR", e.TagName);
            Assert.AreEqual(3, e.Position);
            Assert.IsFalse(e.IsTableOrTBody);
            Assert.AreEqual("TR[3]", e.ToString());
        }
コード例 #5
0
ファイル: HtmlPathTests.cs プロジェクト: riyanhax/Maui
        public void TableElement()
        {
            HtmlPathElement e = new HtmlPathElement("Table", 3);

            Assert.IsTrue(e.IsTableOrTBody);

            e = new HtmlPathElement("Tbody", 3);

            Assert.IsTrue(e.IsTableOrTBody);
        }
コード例 #6
0
        public void ToString_WhenCalled_ReturnsStringInParsableForm()
        {
            var e = new HtmlPathElement("Tr", 3);

            Assert.That(e.ToString(), Is.EqualTo("TR[3]"));

            var clone = HtmlPathElement.Parse(e.ToString());

            Assert.That(clone.TagName, Is.EqualTo("TR"));
            Assert.That(clone.Position, Is.EqualTo(3));
        }
コード例 #7
0
ファイル: HtmlPathTests.cs プロジェクト: riyanhax/Maui
        public void PathElementWithWrongInput()
        {
            try
            {
                HtmlPathElement e = new HtmlPathElement(null, 0);
                Assert.Fail("It should not possible to create a HtmlPathElement with empty TagName");
            }
            catch { }

            try
            {
                HtmlPathElement e = new HtmlPathElement("  ", 0);
                Assert.Fail("It should not possible to create a HtmlPathElement with empty TagName");
            }
            catch { }

            try
            {
                HtmlPathElement e = new HtmlPathElement("TR", -1);
                Assert.Fail("It should not possible to create a HtmlPathElement with negative position");
            }
            catch { }
        }
コード例 #8
0
        public void IsTableCell_ForTR_ReturnsFalse()
        {
            var e = new HtmlPathElement("TR", 3);

            Assert.That(e.IsTableCell, Is.False);
        }
コード例 #9
0
        public void IsTableCell_ForTBody_ReturnsTrue()
        {
            var e = new HtmlPathElement("TH", 3);

            Assert.That(e.IsTableCell, Is.True);
        }
コード例 #10
0
        public void IsTable_ForTHead_ReturnsFalse()
        {
            var e = new HtmlPathElement("thead", 3);

            Assert.That(e.IsTable, Is.False);
        }
コード例 #11
0
        public void IsTable_ForTable_ReturnsTrue()
        {
            var e = new HtmlPathElement("Table", 3);

            Assert.That(e.IsTable, Is.True);
        }