public void Bug_MI308_Reproduce(){ var selector = ".text p, .text div"; var xml = XElement.Parse("<div><div class='text'><div>a</div><p>b</p><span>z</span><p>c</p><div>d</div></div></div>"); var selectresult = new CssSelectorImpl().Select(xml,selector).ToArray(); Assert.AreEqual(4,selectresult.Length); Assert.AreEqual("abcd",string.Join("",selectresult.Select(_=>_.Value))); }
public void Bug_MI308_Reproduce() { var selector = ".text p, .text div"; var xml = XElement.Parse("<div><div class='text'><div>a</div><p>b</p><span>z</span><p>c</p><div>d</div></div></div>"); var selectresult = new CssSelectorImpl().Select(xml, selector).ToArray(); Assert.AreEqual(4, selectresult.Length); Assert.AreEqual("abcd", string.Join("", selectresult.Select(_ => _.Value))); }
public void CanSelect(string source, string clause, IEnumerable<string> result, int count) { var cssSelector = new CssSelectorImpl(); var selected = cssSelector.Select(XElement.Parse(source), clause); Assert.AreEqual(count, selected.Count()); foreach (var i in selected.Select(_ => _.ToString())) { Assert.IsTrue(result.Contains(i)); } }
public void NormalUnifiedAndDefaultTest(string query,string[] eresult) { var us = new CssSelectorImpl(); var elements = us.Select(XElement.Parse(SAMPLE_HTML), query); var result = elements.Select(_ => _.ToString()).ToArray(); CollectionAssert.AreEquivalent(eresult,result); var ds = new DefaultSelector(); elements = ds.Select(XElement.Parse(SAMPLE_HTML), query); result = elements.Select(_ => _.ToString()).ToArray(); CollectionAssert.AreEquivalent(eresult, result); }
public void CanSelect(string source, string clause, IEnumerable <string> result, int count) { var cssSelector = new CssSelectorImpl(); var selected = cssSelector.Select(XElement.Parse(source), clause); Assert.AreEqual(count, selected.Count()); foreach (var i in selected.Select(_ => _.ToString())) { Assert.IsTrue(result.Contains(i)); } }
public void NormalUnifiedAndDefaultTest(string query, string[] eresult) { var us = new CssSelectorImpl(); var elements = us.Select(XElement.Parse(SAMPLE_HTML), query); var result = elements.Select(_ => _.ToString()).ToArray(); CollectionAssert.AreEquivalent(eresult, result); var ds = new DefaultSelector(); elements = ds.Select(XElement.Parse(SAMPLE_HTML), query); result = elements.Select(_ => _.ToString()).ToArray(); CollectionAssert.AreEquivalent(eresult, result); }