Esempio n. 1
0
        public void UploadAnNonExistingLocalFile()
        {
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.RemoveFile(localFilePath);

            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();

            CommandAgent.UploadFile(this.fileShare, localFilePath, cloudFileName);
            CommandAgent.Invoke();
            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.PathNotFoundFullQualifiedErrorId));
        }
Esempio n. 2
0
        public void UploadWithPassThru()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            CommandAgent.UploadFile(this.fileShare, localFilePath, cloudFileName, false, true);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertNoError();
            result.AssertObjectCollection(obj => obj.AssertCloudFile(cloudFileName));
        }
        public void RemoveNonEmptyDirectoryTest()
        {
            string dir       = CloudFileUtil.GenerateUniqueDirectoryName();
            var    directory = fileUtil.EnsureDirectoryExists(this.fileShare, dir);

            fileUtil.CreateFile(directory, CloudFileUtil.GenerateUniqueFileName());

            CommandAgent.RemoveDirectory(this.fileShare, dir);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.DirectoryNotEmptyFullQualifiedErrorId));
        }
Esempio n. 4
0
        public void UploadToADeletedFolder()
        {
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            var dir = fileUtil.EnsureDirectoryExists(this.fileShare, CloudFileUtil.GenerateUniqueDirectoryName());

            dir.Delete();
            CommandAgent.UploadFile(this.fileShare, localFilePath, CloudFileUtil.GetFullPath(dir) + "/");
            CommandAgent.Invoke();
            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.ParentNotFoundFullQualifiedErrorId));
        }
Esempio n. 5
0
        public void UploadWithInvalidFileName_TooLong()
        {
            string cloudFileName = FileNamingGenerator.GenerateValidateASCIIName(256);
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            CommandAgent.UploadFile(this.fileShare, localFilePath, cloudFileName, true);
            var result = CommandAgent.Invoke();

            result.AssertNoResult();
            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.InvalidArgumentFullQualifiedErrorId));
        }
Esempio n. 6
0
        /// <summary>
        /// Negative functional test case 5.9.8
        /// </summary>
        ////[TestMethod]
        ////[TestCategory(PsTag.File)]
        public void UploadingToExistingFileWithNoOverwriteOption()
        {
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();

            fileUtil.CreateFile(this.fileShare, cloudFileName);

            CommandAgent.UploadFile(this.fileShare, localFilePath, cloudFileName);
            CommandAgent.Invoke();
            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.ResourceAlreadyExistsFullQualifiedErrorId));
        }
Esempio n. 7
0
        public void DownloadFileUsingFileShareNameParameterSet()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            var sourceFile = fileUtil.CreateFile(this.fileShare, cloudFileName, localFilePath);

            UploadAndDownloadFileInternal(
                sourceFile,
                FileUtil.GetFileContentMD5(localFilePath),
                destination => CommandAgent.DownloadFile(this.fileShare.Name, cloudFileName, destination, true));
        }
Esempio n. 8
0
        public void UploadFileFromRelativePathWhereIntermediatePathMightNotExistTest()
        {
            var    baseDir           = fileUtil.EnsureFolderStructure(this.fileShare, "a/b/c");
            string cloudFileName     = CloudFileUtil.GenerateUniqueFileName();
            string relativeCloudPath = "../../ddd/../b/./c/" + cloudFileName;
            string localFilePath     = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            CommandAgent.UploadFile(baseDir, localFilePath, relativeCloudPath);
            CommandAgent.Invoke();
            CommandAgent.AssertNoError();
            Test.Assert(baseDir.GetFileReference(cloudFileName).Exists(), "File should exist after uploaded.");
        }
Esempio n. 9
0
        public void CreateFileAndListThroughSMBTest()
        {
            string fileName      = CloudFileUtil.GenerateUniqueFileName();
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            CommandAgent.UploadFile(this.fileShare, localFilePath, fileName);
            CommandAgent.Invoke();
            CommandAgent.AssertNoError();
            SMBValidationRetry(
                () => this.mountedShareRoot.GetFiles().Select(x => x.Name).Contains(fileName),
                "list the newly created directory through SMB protocol");
        }
        public void RemoveNonExistingFileInANonExistingDirectory()
        {
            string directoryName = CloudFileUtil.GenerateUniqueDirectoryName();

            fileUtil.DeleteDirectoryIfExists(this.fileShare, directoryName);
            string fileName = CloudFileUtil.GenerateUniqueFileName();
            var    file     = this.fileShare.GetRootDirectoryReference().GetDirectoryReference(directoryName).GetFileReference(fileName);

            CommandAgent.RemoveFile(this.fileShare, file.Name);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.ParentNotFoundFullQualifiedErrorId, AssertUtil.ResourceNotFoundFullQualifiedErrorId));
        }
        public void RemoveUsingRelativePathFromDirectoryObject()
        {
            var    baseDir           = fileUtil.EnsureFolderStructure(this.fileShare, "a/b/c");
            string cloudFileName     = CloudFileUtil.GenerateUniqueFileName();
            string cloudPath         = "a/b/c/" + cloudFileName;
            string relativeCloudPath = "../../b/./c/" + cloudFileName;
            var    sourceFile        = fileUtil.CreateFile(this.fileShare, cloudPath);

            CommandAgent.RemoveFile(baseDir, relativeCloudPath);
            CommandAgent.Invoke();
            CommandAgent.AssertNoError();
            Test.Assert(!sourceFile.Exists(), "File should not exist after removed.");
        }
Esempio n. 12
0
        public void DownloadingFromNonExistingFileShare()
        {
            string fileShareName = CloudFileUtil.GenerateUniqueFileShareName();

            fileUtil.DeleteFileShareIfExists(fileShareName);

            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();

            CommandAgent.DownloadFile(fileShareName, cloudFileName, Test.Data.Get("TempDir"), true);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.InvalidOperationExceptionFullQualifiedErrorId, AssertUtil.PathNotFoundFullQualifiedErrorId, AssertUtil.ResourceNotFoundFullQualifiedErrorId));
        }
Esempio n. 13
0
        public void DownloadingFromNonExistingDirectory()
        {
            string cloudDirectoryName = CloudFileUtil.GenerateUniqueDirectoryName();

            fileUtil.DeleteDirectoryIfExists(this.fileShare, cloudDirectoryName);
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            var    file          = this.fileShare.GetRootDirectoryReference().GetDirectoryReference(cloudDirectoryName).GetFileReference(cloudFileName);

            CommandAgent.DownloadFile(file, Test.Data.Get("TempDir"), true);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.InvalidOperationExceptionFullQualifiedErrorId, AssertUtil.PathNotFoundFullQualifiedErrorId, AssertUtil.ResourceNotFoundFullQualifiedErrorId));
        }
Esempio n. 14
0
        public void UploadToCloudDirectory()
        {
            string cloudFileName      = CloudFileUtil.GenerateUniqueFileName();
            string cloudDirectoryName = CloudFileUtil.GenerateUniqueDirectoryName();
            var    directory          = fileUtil.EnsureDirectoryExists(this.fileShare, cloudDirectoryName);
            string localFilePath      = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            CommandAgent.UploadFile(directory, localFilePath, cloudFileName, true);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertNoError();
            result.AssertNoResult();
        }
Esempio n. 15
0
        public void DownloadWithInvalidKeyValueTest()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            var    file          = fileUtil.DeleteFileIfExists(this.fileShare, cloudFileName);

            // Creates an storage context object with invalid key value
            var    invalidAccount = CloudFileUtil.MockupStorageAccount(StorageAccount, mockupAccountKey: true);
            object invalidStorageContextObject = CommandAgent.CreateStorageContextObject(invalidAccount.ToString(true));

            CommandAgent.DownloadFile(this.fileShare.Name, file.Name, Test.Data.Get("TempDir"), true, invalidStorageContextObject);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.AuthenticationFailedFullQualifiedErrorId, AssertUtil.ProtocolErrorFullQualifiedErrorId));
        }
        public void RemoveFileUnderADirectory()
        {
            string cloudFileName      = CloudFileUtil.GenerateUniqueFileName();
            string cloudDirectoryName = CloudFileUtil.GenerateUniqueDirectoryName();
            var    directory          = fileUtil.EnsureDirectoryExists(this.fileShare, cloudDirectoryName);
            var    file = fileUtil.CreateFile(directory, cloudFileName);

            CommandAgent.RemoveFile(file);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertNoError();
            result.AssertNoResult();
            fileUtil.AssertFileNotExists(this.fileShare, file.Name, "File should not exist after deleting.");
        }
        public void RemoveNonExitingFileWhichMatchingPrefixOfAnExistingOne()
        {
            string fileName = CloudFileUtil.GenerateUniqueFileName();

            fileUtil.DeleteFileIfExists(this.fileShare, fileName);
            string existingFile = fileName + "postfix";

            fileUtil.CreateFile(this.fileShare, existingFile);

            CommandAgent.RemoveFile(this.fileShare, fileName);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.ResourceNotFoundFullQualifiedErrorId));
        }
Esempio n. 18
0
        public void DownloadUsingPath()
        {
            var    baseDir       = fileUtil.EnsureFolderStructure(this.fileShare, "a/b/c");
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            string cloudPath     = "/a/b/c/" + cloudFileName;
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            var sourceFile = fileUtil.CreateFile(this.fileShare, cloudPath, localFilePath);

            UploadAndDownloadFileInternal(
                sourceFile,
                FileUtil.GetFileContentMD5(localFilePath),
                destination => CommandAgent.DownloadFile(this.fileShare, cloudPath, destination, true));
        }
Esempio n. 19
0
        public void DownloadWithInvalidAccountTest()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            var    file          = fileUtil.DeleteFileIfExists(this.fileShare, cloudFileName);

            // Creates an storage context object with invalid account
            // name.
            var    invalidAccount = CloudFileUtil.MockupStorageAccount(StorageAccount, mockupAccountName: true);
            object invalidStorageContextObject = CommandAgent.CreateStorageContextObject(invalidAccount.ToString(true));

            CommandAgent.DownloadFile(this.fileShare.Name, file.Name, Test.Data.Get("TempDir"), true, invalidStorageContextObject);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.AccountIsDisabledFullQualifiedErrorId, AssertUtil.NameResolutionFailureFullQualifiedErrorId, AssertUtil.ResourceNotFoundFullQualifiedErrorId, AssertUtil.ProtocolErrorFullQualifiedErrorId, AssertUtil.InvalidResourceFullQualifiedErrorId));
        }
Esempio n. 20
0
        public void DownloadFileInASubDirectory()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            string directoryName = CloudFileUtil.GenerateUniqueDirectoryName();
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            var subDirectory = fileUtil.EnsureDirectoryExists(this.fileShare, directoryName);
            var sourceFile   = fileUtil.CreateFile(subDirectory, cloudFileName, localFilePath);

            UploadAndDownloadFileInternal(
                sourceFile,
                FileUtil.GetFileContentMD5(localFilePath),
                destination => CommandAgent.DownloadFile(sourceFile, destination, true));
        }
Esempio n. 21
0
        public void DownloadToAFolderAndOverwrite()
        {
            string cloudFileName     = CloudFileUtil.GenerateUniqueFileName();
            string localFilePath     = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());
            string localExistingPath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            FileUtil.GenerateSmallFile(localExistingPath, Utility.GetRandomTestCount(5, 10), true);
            var sourceFile = fileUtil.CreateFile(this.fileShare, cloudFileName, localFilePath);

            UploadAndDownloadFileInternal(
                sourceFile,
                FileUtil.GetFileContentMD5(localFilePath),
                destination => CommandAgent.DownloadFile(sourceFile, destination, true),
                () => Path.GetDirectoryName(localExistingPath));
        }
Esempio n. 22
0
        public void UploadWithInvalidKeyValueTest()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);

            // Creates an storage context object with invalid key value
            var    invalidAccount = CloudFileUtil.MockupStorageAccount(StorageAccount, mockupAccountKey: true);
            object invalidStorageContextObject = CommandAgent.CreateStorageContextObject(invalidAccount.ToString(true));

            CommandAgent.UploadFile(this.fileShare.Name, localFilePath, cloudFileName, false, false, invalidStorageContextObject);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.AuthenticationFailedFullQualifiedErrorId, AssertUtil.ProtocolErrorFullQualifiedErrorId));
        }
        public void RemoveFileWithInvalidKeyValueTest()
        {
            string fileName = CloudFileUtil.GenerateUniqueFileName();

            fileUtil.CreateFile(this.fileShare, fileName);

            // Creates an storage context object with invalid key value
            var    invalidAccount = CloudFileUtil.MockupStorageAccount(StorageAccount, mockupAccountKey: true);
            object invalidStorageContextObject = CommandAgent.CreateStorageContextObject(invalidAccount.ToString(true));

            CommandAgent.RemoveFile(this.fileShare.Name, fileName, invalidStorageContextObject);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.AuthenticationFailedFullQualifiedErrorId, AssertUtil.ProtocolErrorFullQualifiedErrorId));
            fileUtil.AssertFileExists(this.fileShare, fileName, "File should not be removed when providing invalid credentials.");
        }
Esempio n. 24
0
        public void UploadingToNonExistingDirectory()
        {
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);

            string cloudDirectoryName = CloudFileUtil.GenerateUniqueDirectoryName();

            fileUtil.DeleteDirectoryIfExists(this.fileShare, cloudDirectoryName);
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            var    file          = this.fileShare.GetRootDirectoryReference().GetDirectoryReference(cloudDirectoryName).GetFileReference(cloudFileName);

            CommandAgent.UploadFile(this.fileShare, localFilePath, CloudFileUtil.GetFullPath(file));
            CommandAgent.Invoke();
            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.ParentNotFoundFullQualifiedErrorId));
        }
Esempio n. 25
0
        /// <summary>
        /// Negative functional test case 5.9.3
        /// </summary>
        ////[TestMethod]
        ////[TestCategory(PsTag.File)]
        public void UploadToExistingFileWithoutOverwrite()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            var    file          = fileUtil.CreateFile(this.fileShare, cloudFileName);

            file.FetchAttributes();
            var    etag          = file.Properties.ETag;
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            CommandAgent.UploadFile(this.fileShare, localFilePath, cloudFileName, false);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.ResourceAlreadyExistsFullQualifiedErrorId));
            file.FetchAttributes();
            Test.Assert(etag == file.Properties.ETag, "File should not be overwritten without overwrite flag.");
        }
Esempio n. 26
0
        public void UploadToAFileWhichHasJustBeenRemoved()
        {
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();

            // Creates the file and delete it.
            var file = fileUtil.CreateFile(this.fileShare, cloudFileName);

            file.Delete();

            // Upload the file immediately
            CommandAgent.UploadFile(this.fileShare, localFilePath, cloudFileName);
            CommandAgent.Invoke();
            CommandAgent.AssertNoError();
            fileUtil.AssertFileExists(this.fileShare, cloudFileName, "File should exist after uploaded.");
        }
Esempio n. 27
0
        public void CreateFileAndListThroughPSHTest()
        {
            string fileName      = CloudFileUtil.GenerateUniqueFileName();
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            byte[] randomContent = new byte[10240];
            this.randomProvider.NextBytes(randomContent);
            using (var stream = File.Create(Path.Combine(this.mountedShareRoot.FullName, fileName)))
            {
                stream.Write(randomContent, 0, randomContent.Length);
            }

            CommandAgent.GetFile(this.fileShare);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertNoError();
            result.AssertObjectCollection(obj => obj.AssertCloudFile(fileName));
        }
Esempio n. 28
0
        public void DownloadFileFromShareSnapshot_dir()
        {
            string shareName = CloudFileUtil.GenerateUniqueFileShareName();
            string dirName   = CloudFileUtil.GenerateUniqueDirectoryName();
            string fileName  = CloudFileUtil.GenerateUniqueFileName();

            try
            {
                CloudFileShare     share          = fileUtil.EnsureFileShareExists(shareName);
                CloudFileShare     shareSnapshot1 = share.Snapshot();
                CloudFileDirectory dir            = fileUtil.EnsureDirectoryExists(share, dirName);
                CloudFile          file           = fileUtil.CreateFile(dir, fileName);
                CloudFileShare     shareSnapshot2 = share.Snapshot();
                file.Delete();
                dir.Delete();

                //Get File content
                string StorageConnectionString = Test.Data.Get("StorageConnectionString");
                Test.Assert((CommandAgent as PowerShellAgent).InvokePSScript(string.Format(",(New-AzureStorageContext -ConnectionString \"{5}\" | Get-AzureStorageShare -Name {0} -SnapshotTime \"{1}\").GetRootDirectoryReference().GetDirectoryReference(\"{4}\") | Get-AzureStorageFileContent -Path {2} -Destination {3} -Force",
                                                                                           shareName,
                                                                                           shareSnapshot2.SnapshotTime.Value,
                                                                                           fileName,
                                                                                           fileName,
                                                                                           dirName,
                                                                                           StorageConnectionString)),
                            string.Format("Download File {0} from share snapshot {1}, {2} should success.", dirName + "\\" + fileName, shareName, shareSnapshot2.SnapshotTime.Value));

                //validate MD5
                CloudFile file2 = shareSnapshot2.GetRootDirectoryReference().GetDirectoryReference(dirName).GetFileReference(fileName);
                file2.FetchAttributes();
                Test.Assert(file2.Properties.ContentMD5 == FileUtil.GetFileContentMD5(fileName), "Expected MD5: {0}, real MD5: {1}", file2.Properties.ContentMD5, FileUtil.GetFileContentMD5(fileName));
            }
            finally
            {
                try
                {
                    fileUtil.DeleteFileShareIfExists(shareName);
                }
                catch (Exception e)
                {
                    Test.Warn("Unexpected exception when cleanup file share {0}: {1}", shareName, e);
                }
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Negative functional test case 5.8.5
        /// </summary>
        ////[TestMethod]
        ////[TestCategory(PsTag.File)]
        public void DownloadToAnExistingFilePath()
        {
            string cloudFileName     = CloudFileUtil.GenerateUniqueFileName();
            string localFilePath     = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());
            string localExistingPath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            FileUtil.GenerateSmallFile(localExistingPath, Utility.GetRandomTestCount(5, 10), true);
            var sourceFile = fileUtil.CreateFile(this.fileShare, cloudFileName, localFilePath);

            UploadAndDownloadFileInternal(
                sourceFile,
                FileUtil.GetFileContentMD5(localFilePath),
                destination => CommandAgent.DownloadFile(sourceFile, destination, false),
                () => localExistingPath,
                false);

            CommandAgent.AssertErrors(err => err.AssertError("IOException"));
        }
Esempio n. 30
0
        public void UploadAndOverwrite()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();

            fileUtil.CreateFile(this.fileShare, cloudFileName);
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            CommandAgent.UploadFile(this.fileShare, localFilePath, cloudFileName, true);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertNoError();
            if (lang == Language.NodeJS)
            {
                result.AssertObjectCollection(obj => result.AssertCloudFile(obj, "/" + cloudFileName));
            }
            else
            {
                result.AssertNoResult();
            }
        }