Beispiel #1
0
        public void TestGlobal()
        {
            IEnumerable <PropertyDefinition> list = TestList();

            var result = CategoryTreeCache.BuildCache(list, ConfigTypes.Global);

            Assert.AreEqual(1, result.Count());

            var enumerator = result.GetEnumerator();

            enumerator.MoveNext();

            var first = enumerator.Current;

            result = first.Children;


            //two root nodes --> /a/ and /d/
            Assert.AreEqual(2, result.Count());

            enumerator = result.GetEnumerator();
            enumerator.MoveNext();

            first = enumerator.Current;
            Assert.AreEqual("/Global/a/", first.FullKey);
            // /a/b and /a/c/
            Assert.AreEqual(2, first.Children.Count());
            // /a/prop5 and /a/prop3
            Assert.AreEqual(2, first.Definitions.Count());

            enumerator.MoveNext();
            CategoryDTO second = enumerator.Current;

            Assert.AreEqual("/Global/d/", second.FullKey);
            Assert.AreEqual(1, second.Definitions.Count());
            Assert.AreEqual("/Global/d/prop4", second.Definitions.First().FullKey);
        }
Beispiel #2
0
        public void TestWC()
        {
            var list = TestList();

            var result = CategoryTreeCache.BuildCache(list, ConfigTypes.WhereClauses);

            //just _whereclauses
            Assert.AreEqual(1, result.Count());

            var enumerator = result.GetEnumerator();

            enumerator.MoveNext();

            var first = enumerator.Current;

            result = first.Children;


            //two root nodes --> /a/ and /b/ and /c/
            Assert.AreEqual(3, result.Count());

            enumerator = result.GetEnumerator();
            enumerator.MoveNext();

            first = enumerator.Current;
            Assert.AreEqual("/_whereclauses/a/", first.FullKey);
            // /a/prop5 and /a/prop3
            Assert.AreEqual(1, first.Definitions.Count());

            enumerator.MoveNext();
            CategoryDTO second = enumerator.Current;

            Assert.AreEqual("/_whereclauses/b/", second.FullKey);
            Assert.AreEqual(1, second.Definitions.Count());
            Assert.AreEqual("/_whereclauses/b/whereclause", second.Definitions.First().FullKey);
        }
Beispiel #3
0
        public void TestUpdate()
        {
            var result = CategoryTreeCache.BuildCache(TestList(), ConfigTypes.Global);

            Assert.IsTrue(CategoryTreeCache.DoUpdate(new CategoryDTO("/Global/a/b/"), result));
        }