Exemplo n.º 1
0
        public void WhereEqualToOneRoot()
        {
            var root  = new QTreeNode <int>(1);
            var items = root.Where(x => x == 1);

            Console.WriteLine(items);
            var test = new[] { 1 };

            Assert.True(!test.Except(items).Any());
        }
Exemplo n.º 2
0
        public void WhereGreaterThanSevenRootChildWithChild()
        {
            var root = new QTreeNode <int>(1);

            root.Insert(new QTreeNode <int>(2));
            root.Insert(new QTreeNode <int>(3));
            root.Child(1).Insert(new QTreeNode <int>(5));
            root.Child(1).Insert(new QTreeNode <int>(6));
            root.Child(1).Insert(new QTreeNode <int>(7));
            root.Child(1).Insert(new QTreeNode <int>(8));
            root.Child(1).Child(3).Insert(new QTreeNode <int>(24));
            root.Child(0).Insert(new QTreeNode <int>(48));
            var items = root.Where(x => x > 7);

            var enumerable = items as int[] ?? items.ToArray();

            Assert.True(enumerable.Contains(24));
            Assert.True(enumerable.Contains(48));
            Assert.True(enumerable.Contains(8));
            Assert.False(enumerable.Contains(7));

            Assert.False(enumerable.Contains(1));
            Assert.True(enumerable.Length == 3);
        }