public void Parse_WhenCalled_TagNameAndPositionExtracted() { var e = HtmlPathElement.Parse("table[2]"); Assert.AreEqual("TABLE", e.TagName); Assert.AreEqual(2, e.Position); }
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)); }
public void ElementParse() { HtmlPathElement e = HtmlPathElement.Parse("table[2]"); Assert.AreEqual("TABLE", e.TagName); Assert.AreEqual(2, e.Position); Assert.IsTrue(e.IsTableOrTBody); }
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()); }
public void TableElement() { HtmlPathElement e = new HtmlPathElement("Table", 3); Assert.IsTrue(e.IsTableOrTBody); e = new HtmlPathElement("Tbody", 3); Assert.IsTrue(e.IsTableOrTBody); }
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)); }
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 { } }
public void IsTableCell_ForTR_ReturnsFalse() { var e = new HtmlPathElement("TR", 3); Assert.That(e.IsTableCell, Is.False); }
public void IsTableCell_ForTBody_ReturnsTrue() { var e = new HtmlPathElement("TH", 3); Assert.That(e.IsTableCell, Is.True); }
public void IsTable_ForTHead_ReturnsFalse() { var e = new HtmlPathElement("thead", 3); Assert.That(e.IsTable, Is.False); }
public void IsTable_ForTable_ReturnsTrue() { var e = new HtmlPathElement("Table", 3); Assert.That(e.IsTable, Is.True); }