예제 #1
0
        public void AppModel_ResolveFromPredefinedPaths_All()
        {
            var paths = new string[]
            {
                "/Root/AA/BB/CC",
                "/Root/AA/BB",
                "/Root/System/Schema/ContentTypes/GenericContent/ListItem",
                "/Root/AA",
            };
            var expectedList = GetPathsInSubTree("/Root/System/Schema/ContentTypes/GenericContent/ListItem");

            var nodeHeads = ApplicationResolver.ResolveAllByPaths(paths, true);
            var paths1    = nodeHeads.Select(h => h.Path).Except(expectedList).ToArray();

            Assert.IsTrue(paths1.Count() == 0, "Expected empty array but: " + String.Join(", ", paths1));

            //---------------------------------

            expectedList = new string[]
            {
                "/Root/System/Schema/ContentTypes/GenericContent/ListItem",
            };
            nodeHeads = ApplicationResolver.ResolveAllByPaths(paths, false);
            Assert.IsTrue(nodeHeads.Select(h => h.Path).Except(expectedList).Count() == 0, "##2");
        }
예제 #2
0
        public void AppModel_ResolveFromPredefinedPaths_All()
        {
            IntegrationTest(() =>
            {
                var backup = Indexing.IsOuterSearchEngineEnabled;
                Indexing.IsOuterSearchEngineEnabled = false;
                try
                {
                    var paths = new[]
                    {
                        "/Root/AA/BB/CC",
                        "/Root/AA",
                        "/Root/System",
                        "/Root",
                    };

                    // ACTION
                    var nodeHeads = ApplicationResolver.ResolveAllByPaths(paths, false).ToArray();

                    // ASSERT
                    Assert.AreEqual(2, nodeHeads.Length);
                    Assert.AreEqual("/Root/System", nodeHeads[0].Path);
                    Assert.AreEqual("/Root", nodeHeads[1].Path);
                }
                finally
                {
                    Indexing.IsOuterSearchEngineEnabled = backup;
                }
            });
        }
예제 #3
0
        public void AppModel_PathResolver_TypeAndPath()
        {
            var expectedList = new string[]
            {
                "/Root/AA/BB/AppFolder/This/AppName",
                "/Root/AA/BB/AppFolder/HTMLContent/AppName",
                "/Root/AA/BB/AppFolder/WebContent/AppName",
                "/Root/AA/BB/AppFolder/ListItem/AppName",
                "/Root/AA/BB/AppFolder/GenericContent/AppName",
                "/Root/AA/AppFolder/HTMLContent/AppName",
                "/Root/AA/AppFolder/WebContent/AppName",
                "/Root/AA/AppFolder/ListItem/AppName",
                "/Root/AA/AppFolder/GenericContent/AppName",
                "/Root/AppFolder/HTMLContent/AppName",
                "/Root/AppFolder/WebContent/AppName",
                "/Root/AppFolder/ListItem/AppName",
                "/Root/AppFolder/GenericContent/AppName",
            };
            var paths = ApplicationResolver.GetAvailablePaths("/Root/AA/BB", ActiveSchema.NodeTypes["HTMLContent"], "AppFolder", "AppName", HierarchyOption.TypeAndPath);

            Assert.IsTrue(paths.Count() == expectedList.Count(), "Counts are not equals");
            var i = -1;

            foreach (var path in paths)
            {
                Assert.IsTrue(path == expectedList[++i], "#" + i);
            }
        }
예제 #4
0
        public void AppModel_ResolveFromPredefinedPaths_First()
        {
            IntegrationTest(() =>
            {
                var backup = Indexing.IsOuterSearchEngineEnabled;
                Indexing.IsOuterSearchEngineEnabled = false;
                try
                {
                    var paths = new[]
                    {
                        "/Root/AA/BB/CC",
                        "/Root/AA",
                        "/Root/System",
                        "/Root",
                    };

                    // ACTION
                    var nodeHead = ApplicationResolver.ResolveFirstByPaths(paths);

                    // ASSERT
                    Assert.IsNotNull(nodeHead);
                    Assert.AreEqual("/Root/System", nodeHead.Path);
                }
                finally
                {
                    Indexing.IsOuterSearchEngineEnabled = backup;
                }
            });
        }
예제 #5
0
        public void AppModel_ResolveFromPredefinedPaths_First()
        {
            var paths = new string[]
            {
                "/Root/AA/BB/CC",
                "/Root/AA",
                "/Root/System",
                "/Root",
            };
            var nodeHead = ApplicationResolver.ResolveFirstByPaths(paths);

            Assert.IsNotNull(nodeHead);
            Assert.IsTrue(nodeHead.Path == "/Root/System", "Path does not equal the expected");
        }