public void CanMoveDirectory_ToRootDirectory() { Directory d = (Directory)upload.GetChild("Folder 2/Folder 3"); string sourcePath = MapPath("/Upload/Folder 2/Folder 3"); string destinationPath = MapPath("/Upload/Folder 3"); try { d.AddTo(upload); Assert.That(System.IO.Directory.Exists(destinationPath)); Assert.That(!System.IO.Directory.Exists(sourcePath)); } finally { if (System.IO.Directory.Exists(destinationPath)) { System.IO.Directory.Move(destinationPath, sourcePath); } } }
public void MoveDirectory_TriggersEvent() { Directory d = (Directory)upload.GetChild("Folder 2/Folder 3"); string sourcePath = MapPath("/Upload/Folder 2/Folder 3"); string destinationPath = MapPath("/Upload/Folder1/Folder 3"); try { d.AddTo(upload.GetChild("Folder1")); Assert.That(arguments[0].SourcePath, Is.EqualTo("/Upload/Folder 2/Folder 3/")); Assert.That(arguments[0].VirtualPath, Is.EqualTo("/Upload/Folder1/Folder 3")); Assert.That(operations[0], Is.EqualTo("DirectoryMoved")); } finally { if (System.IO.Directory.Exists(destinationPath)) { System.IO.Directory.Move(destinationPath, sourcePath); } } }