public void TestXPath() { string test = "<html><myTag foo='bar' /></html>"; HtmlTagTester tag = HtmlTagTester.TestInstance(test, "//*[@foo='bar']"); WebAssert.Visible(tag); }
public void TestChild_WhenTwoManyChildren() { string test = "<p id='parent'><one>1</one><two>A</two><two>B</two></p>"; HtmlTagTester tag = HtmlTagTester.TestInstance(test, "parent", test); tag.Child("two"); }
private void AssertRenders(string expected, string tagBody) { string html = "<p id='renderTest'>" + tagBody + "</p>"; HtmlTagTester tag = HtmlTagTester.TestInstance(html, "renderTest", html); Assert.AreEqual(expected, tag.RenderedInnerHtml); }
public void TestChild() { string test = "<p id='parent'><one>1</one><two>A</two><two>B</two></p>"; HtmlTagTester tag = HtmlTagTester.TestInstance(test, "parent", test); Assert.AreEqual("1", tag.Child("one").InnerHtml); }
/// <summary> /// For internal use. May change in future revisions. /// </summary> public ListItemCollectionTester(HtmlTagTester[] optionList, HtmlSelectTester container) { foreach (HtmlTagTester option in optionList) { InnerList.Add(new ListItemTester(option, container)); } }
public void TestVisibility() { string test = "<html><myTag id='tagOne' /></html>"; HtmlTagTester tagOne = HtmlTagTester.TestInstance(test, "tagOne", test); HtmlTagTester tagNone = HtmlTagTester.TestInstance(test, "tagNone", test); Assert.IsTrue(tagOne.Visible); Assert.IsFalse(tagNone.Visible); }
public void TestChildrenByXPath() { string test = "<p id='parent'><c attrib='pickMe' /><c attrib='ignoreMe' /></p>"; HtmlTagTester p = HtmlTagTester.TestInstance(test, "parent", "test doc"); HtmlTagTester[] result = p.ChildrenByXPath("c[@attrib='pickMe']"); Assert.AreEqual(2, p.Children("c").Length); Assert.AreEqual(1, result.Length); Assert.AreEqual("xpath <c[@attrib='pickMe']> child #0 of test doc", result[0].Description); }
/// <summary> /// Click a column heading link that was generated with the "allowSorting='true'" attribute. /// </summary> /// <param name="columnNumberZeroBased">The column to sort (zero-based)</param> public void Sort(int columnNumberZeroBased) { AssertVisible(); Row header = GetHeaderRow(); HtmlTagTester cell = header.GetCellElement(columnNumberZeroBased); HtmlTagTester[] links = cell.Children("a"); WebAssert.True(links.Length != 0, "Attempted to sort non-sortable grid (" + HtmlIdAndDescription + ")"); WebAssert.True(links.Length == 1, "Expected sort link to have exactly one anchor tag"); Form.PostBack(links[0].Attribute("href")); }
public void TestChildrenAndHasChildren() { string test = "<html><c>Left</c><p id='parent'><c>0</c><c>1</c><r>red herring</r><c>2</c><c>3<c>nested</c></c><c>4</c></p><c>Right</c></html>"; HtmlTagTester tag = HtmlTagTester.TestInstance(test, "parent", "test doc"); Assert.IsTrue(tag.HasChildren("c")); Assert.IsFalse(tag.HasChildren("x")); Assert.AreEqual("0", tag.Children("c")[0].InnerHtml); Assert.AreEqual("1", tag.Children("c")[1].InnerHtml); Assert.AreEqual("2", tag.Children("c")[2].InnerHtml); Assert.AreEqual("3<c>nested</c>", tag.Children("c")[3].InnerHtml); Assert.AreEqual("4", tag.Children("c")[4].InnerHtml); Assert.AreEqual("<c> child #1 of test doc", tag.Children("c")[1].Description); }
/// <summary> /// For internal use. May change in future revisions. /// </summary> public ListItemTester(HtmlTagTester option, HtmlSelectTester container) { this.container = container; Element = option; }
public void TestHtmlId_WhenNoHtmlId() { string test = "<html><myTag foo='bar' /></html>"; HtmlTagTester tag = HtmlTagTester.TestInstance(test, "//*[@foo='bar']"); string unused = tag.HtmlId; }
public void SetUp() { string test = "<html><myTag id='tag' attr='one'>The body</myTag></html>"; tag = HtmlTagTester.TestInstance(test, "tag", test); }