Exemple #1
0
        public void Attribute_WithMatch_ReturnsAttributeValue()
        {
            var nodes = GetNodes("<a href='someurl'>text</a>");

            var elements = new Elements(nodes);

            Assert.That(elements.Attribute("href"), Is.EqualTo("someurl"));
        }
Exemple #2
0
        public void Attribute_MultipleNodes_ReturnsFirstFoundAttributeValue()
        {
            var nodes = GetNodes("<a href='url'>text</a><a href='otherurl'>text</a>");

            var elements = new Elements(nodes);

            Assert.That(elements.Attribute("href"), Is.EqualTo("url"));
        }
Exemple #3
0
        public void Attribute_WithoutElements_ReturnStringEmpty()
        {
            var elements = new Elements(null);

            Assert.That(elements.Attribute("href"), Is.EqualTo(string.Empty));
        }