예제 #1
0
        private void DumpNodeSequence (JSNodeChildren enumerable) {
            using (var e = enumerable.EnumeratorTemplate)
            while (e.MoveNext()) {
                Console.WriteLine("{0}: {1}", e.CurrentName, e.Current.GetType());
            }

            var nonDistinct = enumerable.ToArray();
            var distinct = nonDistinct.Distinct(new ReferenceComparer<JSNode>()).ToArray();
            Assert.AreEqual(distinct.Length, nonDistinct.Length, "Enumeration contains duplicates");
        }
예제 #2
0
        protected JSNode()
        {
            TypeId = GetTypeId(GetType());

            var td = JSNodeTraversalData.Get(TypeId);

            Children                 = new JSNodeChildren(this, td, false);
            SelfAndChildren          = new JSNodeChildren(this, td, true);
            AllChildrenRecursive     = new JSNodeChildrenRecursive(this, td, false);
            SelfAndChildrenRecursive = new JSNodeChildrenRecursive(this, td, true);
        }
예제 #3
0
        public JSNode()
        {
            TypeId = TypeIds[GetType()];

            var td = JSNodeTraversalData.Get(TypeId);

            Children                 = new JSNodeChildren(this, td, false);
            SelfAndChildren          = new JSNodeChildren(this, td, true);
            AllChildrenRecursive     = new JSNodeChildrenRecursive(this, td, false);
            SelfAndChildrenRecursive = new JSNodeChildrenRecursive(this, td, true);
        }
예제 #4
0
        private void DumpNodeSequence (JSNodeChildren enumerable) {
            using (var e = enumerable.EnumeratorTemplate)
            while (e.MoveNext()) {
                Console.WriteLine("{0}: {1}", e.CurrentName, e.Current.GetType());
            }

            var nonDistinct = enumerable.ToArray();
            var distinct = nonDistinct.Distinct(new ReferenceComparer<JSNode>()).ToArray();
            Assert.AreEqual(distinct.Length, nonDistinct.Length, "Enumeration contains duplicates");
        }