コード例 #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
ファイル: FsmXObjects.cs プロジェクト: kayoub5/LinqToXsdCore
        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));
 }