예제 #1
0
        public void TestHasDataElement()
        {
            HElement element = new HElement("div", new HAttribute("data-value1", "value1"));

            Assert.Equal(true, element.HasData("Value1"));
            Assert.Equal(false, element.HasData("Value2"));

            element = null;

            Assert.Equal(false, element.HasData("Value1"));
            Assert.Equal(false, element.HasData("Value2"));
        }
예제 #2
0
        public void TestHasAnyDataElements()
        {
            HElement element1 = new HElement("div");
            HElement element2 = new HElement("div", new HAttribute("data-value2", "value2"));

            var elements = new HElement[] { element1, null, element2 };

            Assert.Equal(false, elements.HasData());

            elements = new HElement[] { element2, element1, null };
            Assert.Equal(true, elements.HasData());

            elements = new HElement[] { null, element1, element2 };
            Assert.Equal(false, elements.HasData());

            elements = null;
            Assert.Equal(false, elements.HasData());
        }