Beispiel #1
0
 [Test] public void ByNameAndAttributes_NamePart()
 {
     PureElementNameComparisons(ElementSelectors
                                .ByNameAndAttributes(new string[] {}));
     PureElementNameComparisons(ElementSelectors
                                .ByNameAndAttributes(new XmlQualifiedName[] {}));
     PureElementNameComparisons(ElementSelectors.ByNameAndAttributes(BAR));
     PureElementNameComparisons(ElementSelectors
                                .ByNameAndAttributes(new XmlQualifiedName(BAR,
                                                                          SOME_URI)));
 }
Beispiel #2
0
        [Test] public void byNameAndAttributes_QName()
        {
            XmlElement control = doc.CreateElement(FOO);

            control.SetAttribute(BAR, BAR);
            XmlElement equal = doc.CreateElement(FOO);

            equal.SetAttribute(BAR, BAR);
            XmlElement noAttributes   = doc.CreateElement(FOO);
            XmlElement differentValue = doc.CreateElement(FOO);

            differentValue.SetAttribute(BAR, FOO);
            XmlElement differentName = doc.CreateElement(FOO);

            differentName.SetAttribute(FOO, FOO);
            XmlElement differentNS = doc.CreateElement(FOO);

            differentNS.SetAttribute(BAR, SOME_URI, BAR);

            Assert.IsTrue(ElementSelectors.ByNameAndAttributes(new XmlQualifiedName(BAR))
                              (control, equal));
            Assert.IsFalse(ElementSelectors.ByNameAndAttributes(new XmlQualifiedName(BAR))
                               (control, noAttributes));
            Assert.IsTrue(ElementSelectors.ByNameAndAttributes(new XmlQualifiedName(FOO))
                              (control, noAttributes));
            Assert.IsTrue(ElementSelectors.ByNameAndAttributes(new XmlQualifiedName[] {})
                              (control, noAttributes));
            Assert.IsFalse(ElementSelectors.ByNameAndAttributes(new XmlQualifiedName(BAR))
                               (noAttributes, control));
            Assert.IsFalse(ElementSelectors.ByNameAndAttributes(new XmlQualifiedName(BAR))
                               (control, differentValue));
            Assert.IsFalse(ElementSelectors.ByNameAndAttributes(new XmlQualifiedName(BAR))
                               (control, differentName));
            Assert.IsFalse(ElementSelectors.ByNameAndAttributes(new XmlQualifiedName(BAR))
                               (control, differentNS));
        }
Beispiel #3
0
 public void ByNameAndAttributesDoesntLikeNullNameXmlQualifiedNameVersion()
 {
     Assert.Throws <ArgumentException>(() =>
                                       ElementSelectors.ByNameAndAttributes(new XmlQualifiedName[] { null }));
 }
Beispiel #4
0
 public void ByNameAndAttributesDoesntLikeNullNameStringVersion()
 {
     Assert.Throws <ArgumentException>(() =>
                                       ElementSelectors.ByNameAndAttributes(new string[] { null }));
 }
Beispiel #5
0
 public void ByNameAndAttributesDoesntLikeNullArgumentXmlQualifiedNameVersion()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           ElementSelectors.ByNameAndAttributes((XmlQualifiedName[])null));
 }
Beispiel #6
0
 public void ByNameAndAttributesDoesntLikeNullArgumentStringVersion()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           ElementSelectors.ByNameAndAttributes((string[])null));
 }