public void BothWildcardMatchesAnyAttributeAndNamespace() { XmlMatch match = new AttributeMatch("*", "*"); XmlReader reader = GetReader("<root foo='1' x:id='1' xmlns:x='mvp-xml'></root>"); reader.MoveToContent(); reader.MoveToFirstAttribute(); Assert.IsTrue(match.Matches(reader, null)); reader.MoveToNextAttribute(); Assert.IsTrue(match.Matches(reader, null)); }
public void WildcardNameMatchesAnyAttribute() { XmlMatch match = new AttributeMatch("*"); XmlReader reader = GetReader("<foo id='1' enabled='true'></foo>"); reader.MoveToContent(); reader.MoveToFirstAttribute(); Assert.IsTrue(match.Matches(reader, null)); reader.MoveToNextAttribute(); Assert.IsTrue(match.Matches(reader, null)); }
public void WildcardNamespaceMatchesAttributesInAnyNamespace() { XmlMatch match = new AttributeMatch("*", "id"); XmlReader reader = GetReader("<root id='1' x:id='1' xmlns:x='mvp-xml'></foo>"); reader.MoveToContent(); reader.MoveToFirstAttribute(); Assert.IsTrue(match.Matches(reader, null)); reader.MoveToNextAttribute(); Assert.IsTrue(match.Matches(reader, null)); }
public void AttributeMatchMatchesOnlyAttribute() { XmlMatch match = new AttributeMatch("id"); XmlReader reader = GetReader("<bar id='23'><foo>hello</foo></bar>"); reader.MoveToContent(); Assert.IsFalse(match.Matches(reader, null)); reader.MoveToFirstAttribute(); Assert.IsTrue(match.Matches(reader, null)); reader.MoveToElement(); reader.Read(); Assert.IsFalse(match.Matches(reader, null)); }
public void WildcardNameDoesNotMatchWrongAttributeNamespace() { XmlMatch match = new AttributeMatch("*"); XmlReader reader = GetReader("<foo id='1' x:enabled='true' xmlns:x='mvp-xml'><bar x:enabled='true' xmlns:x='mvp-xml'/></foo>"); reader.MoveToContent(); Assert.IsFalse(match.Matches(reader, null)); reader.MoveToFirstAttribute(); Assert.IsTrue(match.Matches(reader, null)); reader.MoveToNextAttribute(); Assert.IsFalse(match.Matches(reader, null)); reader.MoveToNextAttribute(); Assert.IsFalse(match.Matches(reader, null)); reader.Read(); Assert.IsFalse(match.Matches(reader, null)); }