コード例 #1
0
        public void WebsiteItemPathToProjectFileNameTests()
        {
            var pathMapperService = new PathMapperService();

            pathMapperService.WebsiteItemPathToProjectDirectories.Add(new WebsiteItemPathToProjectDirectoryMapper("master", "/sitecore/content/Home", "/content/master/sitecore/content/Home", "item.json", "CleanBlog/**", string.Empty, string.Empty, string.Empty));

            string projectFileName;
            string format;
            Assert.IsTrue(pathMapperService.TryGetProjectFileName("/sitecore/content/Home/CleanBlog/Posts/Post1", string.Empty, out projectFileName, out format));
            Assert.AreEqual("content\\master\\sitecore\\content\\Home\\CleanBlog\\Posts\\Post1.item.json", projectFileName);
            Assert.AreEqual("item.json", format);

            Assert.IsFalse(pathMapperService.TryGetProjectFileName("/sitecore/content/Home/TodoMvc/Posts/Post1", string.Empty, out projectFileName, out format));
        }
コード例 #2
0
        public void WebsiteFileNameToProjectFileNameTests()
        {
            var pathMapperService = new PathMapperService();

            pathMapperService.WebsiteDirectoryToProjectDirectories.Add(new WebsiteDirectoryToProjectDirectoryMapper("/sitecore modules/shell/module", "/module", "**/*.cshtml", "**/*.png"));
            pathMapperService.WebsiteDirectoryToProjectDirectories.Add(new WebsiteDirectoryToProjectDirectoryMapper("/", "/wwwroot", "**/*.cshtml", "**/*.png"));

            string projectFileName;
            Assert.IsTrue(pathMapperService.TryGetProjectFileName("/sitecore modules/shell/module/overview.cshtml", out projectFileName));
            Assert.AreEqual("module\\overview.cshtml", projectFileName);

            Assert.IsTrue(pathMapperService.TryGetProjectFileName("/views/news.cshtml", out projectFileName));
            Assert.AreEqual("wwwroot\\views\\news.cshtml", projectFileName);

            Assert.IsFalse(pathMapperService.TryGetProjectFileName("/img/about.png", out projectFileName));
        }
コード例 #3
0
        public void WebsiteFileNameToProjectFileNameTests()
        {
            var pathMapperService = new PathMapperService();
            var pathMatcher       = new PathMatcher("**/*.cshtml", "**/*.png");

            pathMapperService.WebsiteDirectoryToProjectDirectories.Add(new WebsiteDirectoryToProjectDirectoryMapper(pathMatcher, "/sitecore modules/shell/module", "/module"));
            pathMapperService.WebsiteDirectoryToProjectDirectories.Add(new WebsiteDirectoryToProjectDirectoryMapper(pathMatcher, "/", "/wwwroot"));

            string projectFileName;

            Assert.IsTrue(pathMapperService.TryGetProjectFileName("/sitecore modules/shell/module/overview.cshtml", out projectFileName));
            Assert.AreEqual("module\\overview.cshtml", projectFileName);

            Assert.IsTrue(pathMapperService.TryGetProjectFileName("/views/news.cshtml", out projectFileName));
            Assert.AreEqual("wwwroot\\views\\news.cshtml", projectFileName);

            Assert.IsFalse(pathMapperService.TryGetProjectFileName("/img/about.png", out projectFileName));
        }
コード例 #4
0
        public void WebsiteItemPathToProjectFileNameTests()
        {
            var pathMapperService = new PathMapperService();

            var itemNamePathMatcher = new PathMatcher("\\sitecore\\content\\Home\\CleanBlog\\**", string.Empty);

            var websiteItemPathToProjectDirectoryMapper = new WebsiteItemPathToProjectDirectoryMapper(itemNamePathMatcher, null, "master", "/sitecore/content/Home", "/content/master/sitecore/content/Home", "item.json");

            pathMapperService.WebsiteItemPathToProjectDirectories.Add(websiteItemPathToProjectDirectoryMapper);

            string projectFileName;
            string format;
            var    condition = pathMapperService.TryGetProjectFileName("/sitecore/content/Home/CleanBlog/Posts/Post1", string.Empty, out projectFileName, out format);

            Assert.IsTrue(condition);
            Assert.AreEqual("content\\master\\sitecore\\content\\Home\\CleanBlog\\Posts\\Post1.item.json", projectFileName);
            Assert.AreEqual("item.json", format);

            Assert.IsFalse(pathMapperService.TryGetProjectFileName("/sitecore/content/Home/TodoMvc/Posts/Post1", string.Empty, out projectFileName, out format));
        }