예제 #1
0
                //[Variation(Priority = 0, Desc = "IEquatable: different names (NS)")]
                public void Variation13()
                {
                    XName nameOne = GetName("nameOne", "ns1");
                    XName nameTwo = GetName("nameOne", "ns2");

                    TestLog.Compare(nameOne != nameTwo, "nameOne and nameTwo are the same objects");
                    TestLog.Compare(!nameOne.Equals(nameTwo), "nameOne and nameTwo are the same objects");
                    TestLog.Compare(!((IEquatable <XName>)nameOne).Equals(nameTwo), "nameOne and nameTwo are not the same objects");
                }
예제 #2
0
        public void StringComparisons()
        {
            string s = "xmlns";
            XName  n = "xmlns";

            Assert.True(s == n);
            Assert.True(n == s);
            Assert.False(s.Equals(n));
            Assert.False(n.Equals(s));
        }
예제 #3
0
        internal XElement ExecuteFSM(IEnumerator <XElement> enumerator, XName requestingXName,
                                     WildCard requestingWildCard)
        {
            XElement currElem         = null;
            WildCard matchingWildCard = null;
            XName    matchingName     = null;

            while (enumerator.MoveNext())
            {
                currElem     = enumerator.Current;
                currentState = FsmMakeTransition(currentState, currElem.Name, out matchingName, out matchingWildCard);

                if (currentState != FSM.InvalidState)
                {
                    if ((requestingXName != null) && (matchingName != null))
                    {
                        if (requestingXName.Equals(currElem.Name))
                        {
                            return(currElem);
                        }
                    }
                    else if ((requestingWildCard != null) && (matchingWildCard != null))
                    {
                        //requesting for ANY
                        if (requestingWildCard.Allows(currElem.Name)
                            ) //Make sure current element is allowed by requesting ANY property
                        {
                            return(currElem);
                        }
                    }
                }
                else
                {
                    //Get stuck. No recovery attempt is provided for now.
                    return(null);
                }
            }

            //No matching elements/wildcards are found
            return(null);
        }
예제 #4
0
 public static IEnumerable <T> WithName <T> (this IEnumerable <XNode> nodes, XName name, bool ignoreCase)
     where T : XNode, INamedXObject
 {
     return(nodes.OfType <T> ().Where(el => XName.Equals(el.Name, name, ignoreCase)));
 }
예제 #5
0
 public static bool IsServerScriptTag(this XElement el)
 {
     return(XName.Equals(el.Name, scriptName, true) && IsRunatServer(el));
 }