예제 #1
0
        protected void CreateFolder(object sender, EventArgs e)
        {
            RootDirectory directory = (RootDirectory)Session["directory"];

            //have to make sure that the list of folders was initialized. If not then it needs to be newed.
            if (directory.folders == null)
            {
                directory.folders = new List <Folder>();
            }

            string virPath = virtualPath.Text;

            if (virPath.Split('/')[1].Equals(""))
            {
                //virPath;
            }
            else
            {
                virPath = virPath + "/";
            }
            Boolean val = directory.AddFolderToCWD(newFolder.Text, virPath);

            if (val)
            {
                //directory.folders.Add(new Folder() { folderName = newFolder.Text });

                MongoDataContext mongoContext = new MongoDataContext();

                mongoContext.UpdateFileStructure(directory);
            }
            else
            {
                Response.Write("Didn't add the new folder");
                //was unable to add the folder to the CWD
            }
//            Response.Redirect("Default.aspx");
        }
        public void WhenAddFolderToRootReturnTrue()
        {
            string newFolder = "something";

            Assert.IsTrue(testRoot.AddFolderToCWD(newFolder, "/"));
        }