public void Moving_Should_Include_SubFolders_And_Files()
        {
            var sourceContents = source.GetFolderContents();

            source.Move(targetPath);
            var target         = VirtualFolder.Create(FileSystem, targetPath);
            var targetContents = target.GetFolderContents();

            Assert.AreEqual(sourceContents.Files.Count(), targetContents.Files.Count());
            Assert.AreEqual(sourceContents.Folders.Count(), targetContents.Folders.Count());

            //check first file
            Assert.AreEqual(sourceContents.Files.First().MetaData.Length, targetContents.Files.First().MetaData.Length);
            Assert.AreEqual(sourceContents.Files.First().MetaData.Name, targetContents.Files.First().MetaData.Name);
            Assert.AreEqual(sourceContents.Files.First().MetaData.ContentType, targetContents.Files.First().MetaData.ContentType);
            Assert.AreEqual(sourceContents.Files.First().MetaData.Length, targetContents.Files.First().MetaData.Length);

            //check second file
            Assert.AreEqual(sourceContents.Files.Last().MetaData.Length, targetContents.Files.Last().MetaData.Length);
            Assert.AreEqual(sourceContents.Files.Last().MetaData.Name, targetContents.Files.Last().MetaData.Name);
            Assert.AreEqual(sourceContents.Files.Last().MetaData.ContentType, targetContents.Files.Last().MetaData.ContentType);
            Assert.AreEqual(sourceContents.Files.Last().MetaData.Length, targetContents.Files.Last().MetaData.Length);

            //check first/second folder name
            Assert.AreEqual(sourceContents.Folders.First().MetaData.Name, targetContents.Folders.First().MetaData.Name);
            Assert.AreEqual(sourceContents.Folders.Last().MetaData.Name, targetContents.Folders.Last().MetaData.Name);
        }
Exemple #2
0
        public void Copying_Folder_Should_Preserve_Copied_Folder_And_Contents()
        {
            var sourcePath = source.MetaData.FullName;

            //perform copy
            source.Copy(targetPath);

            //make sure our source still exists
            Assert.IsTrue(FileSystem.IsFolderAvailable(sourcePath));

            //check contents
            var original = VirtualFolder.Create(FileSystem, sourcePath);

            Assert.AreEqual(2, original.GetFiles().Count());
            Assert.AreEqual(2, original.GetFolders().Count());
        }
        public void Moved_Files_Should_Be_Equal()
        {
            //get download token for source file
            var sourceFile  = source.GetFiles().First().MetaData.FullName;
            var sourceToken = FileSystem.DownloadTransfers.RequestDownloadToken(sourceFile, true);

            FileSystem.DownloadTransfers.CancelTransfer(sourceToken.TransferId, AbortReason.ClientAbort);

            source.Move(targetPath);
            var target = VirtualFolder.Create(FileSystem, targetPath);

            //get download token for moved file
            var targetFile  = target.GetFiles().First().MetaData.FullName;
            var targetToken = FileSystem.DownloadTransfers.RequestDownloadToken(targetFile, true);

            FileSystem.DownloadTransfers.CancelTransfer(targetToken.TransferId, AbortReason.ClientAbort);

            Assert.AreEqual(sourceToken.Md5FileHash, targetToken.Md5FileHash);
        }