Ejemplo n.º 1
0
        [Test][Assert_Admin] public void handledBySiteData()
        {
            UserGroup.Admin.assert();

            Assert.IsFalse("/aaa.txt".siteData_Handle_VirtualPath());
            Assert.IsFalse(tmFileStorage.siteData_Handle_VirtualPath("abc"));
            Assert.IsFalse((null as string).siteData_Handle_VirtualPath());
            Assert.IsFalse((null as TM_FileStorage).siteData_Handle_VirtualPath("aaa.txt"));
            Assert.IsFalse((null as TM_FileStorage).siteData_Handle_VirtualPath(null));

            tmFileStorage.set_Path_SiteData();

            Assert.IsTrue(tmFileStorage.siteData_Handle_VirtualPath("siteData"));
            Assert.IsFalse(tmFileStorage.siteData_Handle_VirtualPath("abc123"));
            //Create test file in siteData


            var file = util_Create_Test_File_In_SiteData("aaa.txt", "some content").fileName();

            Assert.IsTrue(tmFileStorage.siteData_Handle_VirtualPath(file));
            Assert.IsTrue(tmFileStorage.siteData_Handle_VirtualPath("/" + file));
            Assert.IsTrue(tmFileStorage.siteData_Handle_VirtualPath("/abc/" + file));
            Assert.IsTrue(tmFileStorage.siteData_Handle_VirtualPath("/abc/xyz/" + file));
            Assert.IsTrue(tmFileStorage.siteData_Handle_VirtualPath("/abc/../" + file));
            Assert.IsTrue(tmFileStorage.siteData_Handle_VirtualPath("//" + file));
            Assert.IsTrue(tmFileStorage.siteData_Handle_VirtualPath("../" + file));
            Assert.IsFalse(tmFileStorage.siteData_Handle_VirtualPath("../abc.123"));
            Assert.IsFalse(tmFileStorage.siteData_Handle_VirtualPath("abc.123"));
            Assert.IsFalse(tmFileStorage.siteData_Handle_VirtualPath("//abc.123"));
            Assert.IsFalse(tmFileStorage.siteData_Handle_VirtualPath(null));

            UserGroup.None.assert();
        }