Ejemplo n.º 1
0
 [Test] public void Confirm_That_Default_SiteData_Is_Set()
 {
     tmServer.siteData_Config().assert_Not_Null()
     .Name.assert_Is("Site_Data");
     tmFileStorage.path_SiteData().assert_Not_Null()
     .assert_Folder_Exists();
 }
Ejemplo n.º 2
0
 [SetUp] public void setup()
 {
     this.tmProxy_Refresh();
     tmFileStorage = tmProxy.TmFileStorage.assert_Not_Null();
     tmServer      = tmProxy.TmServer.assert_Not_Null();
     path_SiteData = tmFileStorage.path_SiteData();
 }
Ejemplo n.º 3
0
        //Utils
        public string util_Create_Test_File_In_SiteData(string fileName, string fileContents)
        {
            var pathSiteData = tmFileStorage.path_SiteData();
            var filePath     = pathSiteData.pathCombine(fileName);

            Assert.IsFalse(filePath.fileExists());
            fileContents.saveAs(filePath);
            Assert.IsTrue(filePath.fileExists());
            return(filePath);
        }
Ejemplo n.º 4
0
        [Test] public void Issue_838__SiteData_custom_TBot_pages_can_conflict_with_the_main_TBot_pages()
        {
            //Open main Tbot Page and capture number of links

            ieTeamMentor.open_TBot_Login_if_Needed()
            .html().assert_Contains("your friendly TeamMentor Bot", "Welcome to the TBot control center");

            var links_Size = ieTeamMentor.ie.links().size().assert_Bigger_Than(15);

            //Create a Custom TbotPage and confirm it can be executed ok
            tmFileStorage.path_SiteData()
            .folder_Create_Folder("Tbot")                                            // create a TBot folder in the Site_Data folder
            .folder_Create_File("tbotPage.cshtml", "this is an TBot page: @(40+2)"); // create a test Razor page inside it

            ieTeamMentor.page_TBot();                                                // Refresh page

            ie.assert_Has_Link("tbotPage")                                           // check that there is an new Tbot link to 'tbotPage'
            .links().size().assert_Is(links_Size.inc());                             // if the name is unique to the current list, then it should add to the list

            ie.link("Reset Razor Templates").click(); ie.html().assert_Contains("Current Razor Templates");
            ie.link("TBot").click(); ie.html().assert_Contains("Available TBot Commands");
            ie.link("tbotPage").click(); ie.html().assert_Contains("this is an TBot page: 42");


            // Create a Tbot page with the same name of an existing Tbot Page (for example DebugInfo)

            tmFileStorage.path_SiteData()
            .folder_Create_Folder("Tbot")                                                                   // create a TBot folder in the Site_Data folder
            .folder_Create_File("DebugInfo.cshtml", "this is an TBot page: @(40+2)");

            ieTeamMentor.page_TBot();                              // Refresh page

            //**** Here is the core of the Issue_838
            ie.links().size().assert_Is(links_Size.inc());        // there should still be only one new TBOT page (the one added above

            ie.link("Reset Razor Templates").click();
            ie.link("TBot").click();
            ie.link("DebugInfo").click();                          // opening DebugInfo
            ie.html().assert_Contains("this is an TBot page: 42"); // should show the 'overridden' Tbot page
        }
Ejemplo n.º 5
0
        public static bool siteData_Handle_VirtualPath(this TM_FileStorage tmFileStorage, string virtualPath)
        {
            if (tmFileStorage.isNull() || virtualPath.isNull())
            {
                return(false);
            }

            //temp_SwapSiteDataUtil(virtualPath.removeFirstChar());

            var pathSiteData = tmFileStorage.path_SiteData();

            if (pathSiteData.isNull())
            {
                return(false);
            }

            var fullPath = pathSiteData.pathCombine(virtualPath);

            if (fullPath.fileExists().isFalse())
            {
                fullPath = pathSiteData.pathCombine(virtualPath.fileName()); // see if the file is in the root
            }
            if (fullPath.contains(pathSiteData).isFalse())                   // prevent file transversal
            {
                return(false);
            }
            if (fullPath.fileExists())
            {
                return(fullPath.siteData_WriteFileToResponseStream());
            }

            if (virtualPath == "siteData")
            {
                return(true);
            }
            return(false);
        }