Пример #1
0
        public void CanMoveFile_ToRootDirectory()
        {
            File   f               = (File)upload.GetChild("Folder 2/File 2.txt");
            string sourcePath      = MapPath(@"/Upload/Folder 2/File 2.txt");
            string destinationPath = MapPath(@"/Upload/File 2.txt");

            try
            {
                f.AddTo(upload);
                Assert.That(System.IO.File.Exists(destinationPath));
                Assert.That(!System.IO.File.Exists(sourcePath));
            }
            finally
            {
                if (System.IO.File.Exists(destinationPath))
                {
                    System.IO.File.Move(destinationPath, sourcePath);
                }
            }
        }
Пример #2
0
        public void MovingFile_TriggersEvent()
        {
            File      f               = (File)upload.GetChild("Folder 2/Folder 3/File 3.txt");
            string    sourcePath      = MapPath(@"/Upload/Folder 2/Folder 3/File 3.txt");
            string    destinationPath = MapPath(@"/Upload/Folder1/File 3.txt");
            Directory d               = (Directory)upload.GetChild("Folder1");

            try
            {
                f.AddTo(d);

                Assert.That(arguments[0].SourcePath, Is.EqualTo(@"/Upload/Folder 2/Folder 3/File 3.txt"));
                Assert.That(arguments[0].VirtualPath, Is.EqualTo(@"/Upload/Folder1/File 3.txt"));
                Assert.That(operations[0], Is.EqualTo("FileMoved"));
            }
            finally
            {
                if (System.IO.File.Exists(destinationPath))
                {
                    System.IO.File.Move(destinationPath, sourcePath);
                }
            }
        }