Beispiel #1
0
        private void AssertMovement(Action <File, Directory> moveAction)
        {
            Directory sourceDirectory      = (Directory)upload.GetChild("Folder1");
            Directory destinationDirectory = (Directory)upload.GetChild("Folder 2");
            File      f = (File)sourceDirectory.GetChild("File1.txt");

            moveAction(f, destinationDirectory);
            Assert.That(sourceDirectory.GetChild("File1.txt"), Is.Null);
            Assert.That(f.Parent, Is.EqualTo(destinationDirectory));
            Assert.That(destinationDirectory.GetChild("File1.txt"), Is.Not.Null);
        }
Beispiel #2
0
        private void CopyAndDelete(Func <File, Directory, ContentItem> copyAction)
        {
            Directory d1    = (Directory)upload.GetChild("Folder1");
            Directory d2    = (Directory)upload.GetChild("Folder 2");
            File      f     = (File)d1.GetChild("File1.txt");
            File      fCopy = null;

            try
            {
                fCopy = (File)copyAction(f, d2);
                Assert.That(d2.GetChild("File1.txt"), Is.Not.Null);
                Assert.That(fCopy.Parent, Is.EqualTo(d2));
                Assert.That(d1.GetChild("File1.txt"), Is.Not.Null);
                Assert.That(f.Parent, Is.EqualTo(d1));
            }
            finally
            {
                if (fCopy != null)
                {
                    fCopy.Delete();
                }
            }
        }