public void TestRemoveDataElements() { HElement element1 = new HElement("div", new HAttribute("data-value1", "value1"), new HAttribute("data-value2", "value2"), new HAttribute("data-value3", "value3") ); HElement element2 = new HElement("div", new HAttribute("data-value2", "value2"), new HAttribute("data-value3", "value3"), new HAttribute("data-value4", "value4") ); var elements = new HElement[] { element1, null, element2 }; elements.RemoveData("value1", "value4"); Assert.Equal(new String[] { "data-value2", "data-value3", "data-value2", "data-value3" }, elements.Where(e => e != null).SelectMany(e => e.Attributes()).Select(a => a.Name).ToArray()); elements.RemoveData(); Assert.Equal(new String[] { }, elements.Where(e => e != null).SelectMany(e => e.Attributes()).Select(a => a.Name).ToArray()); elements = null; elements.RemoveData(); }