Exemplo n.º 1
0
        public void TestXPath()
        {
            string        test = "<html><myTag foo='bar' /></html>";
            HtmlTagTester tag  = HtmlTagTester.TestInstance(test, "//*[@foo='bar']");

            WebAssert.Visible(tag);
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 /// <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));
     }
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        /// <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"));
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
 /// <summary>
 /// For internal use.  May change in future revisions.
 /// </summary>
 public ListItemTester(HtmlTagTester option, HtmlSelectTester container)
 {
     this.container = container;
     Element = option;
 }
Exemplo n.º 11
0
 /// <summary>
 /// For internal use.  May change in future revisions.
 /// </summary>
 public ListItemTester(HtmlTagTester option, HtmlSelectTester container)
 {
     this.container = container;
     Element        = option;
 }
Exemplo n.º 12
0
 public void TestHtmlId_WhenNoHtmlId()
 {
     string        test   = "<html><myTag foo='bar' /></html>";
     HtmlTagTester tag    = HtmlTagTester.TestInstance(test, "//*[@foo='bar']");
     string        unused = tag.HtmlId;
 }
Exemplo n.º 13
0
        public void SetUp()
        {
            string test = "<html><myTag id='tag' attr='one'>The body</myTag></html>";

            tag = HtmlTagTester.TestInstance(test, "tag", test);
        }
Exemplo n.º 14
0
 public void SetUp()
 {
     string test = "<html><myTag id='tag' attr='one'>The body</myTag></html>";
     tag = HtmlTagTester.TestInstance(test, "tag", test);
 }