예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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));
        }
예제 #5
0
        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));
        }
예제 #6
0
		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));
		}
예제 #7
0
		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));
		}
예제 #8
0
		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));
		}
예제 #9
0
		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));
		}
예제 #10
0
		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));
		}