Beispiel #1
0
        public void DownloadToAnNonExistingFilePath()
        {
            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);
            var destinationFolder = new DirectoryInfo(Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueDirectoryName()));

            if (destinationFolder.Exists)
            {
                destinationFolder.Delete(true);
            }

            var sourceFile = fileUtil.CreateFile(this.fileShare, cloudFileName, localFilePath);

            UploadAndDownloadFileInternal(
                sourceFile,
                FileUtil.GetFileContentMD5(localFilePath),
                destination => CommandAgent.DownloadFile(sourceFile, destination, false),
                () => Path.Combine(destinationFolder.FullName, CloudFileUtil.GenerateUniqueFileName()),
                false);

            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.TransferExceptionFullQualifiedErrorId, AssertUtil.ResourceNotFoundFullQualifiedErrorId));
        }
Beispiel #2
0
        public static void TestClassInitialize(TestContext testContext)
        {
            Test.Info(string.Format("{0} Class Initialize", testContext.FullyQualifiedTestClassName));
            Test.FullClassName = testContext.FullyQualifiedTestClassName;

            //add the common initialization
            if (StorageAccount == null)
            {
                StorageAccount = GetCloudStorageAccountFromConfig(useHttps: useHttps);
                Test.Info("Got storage account from config: {0}", StorageAccount.ToString(true));
            }

            //init the blob helper for blob related operations
            blobUtil  = new CloudBlobUtil(StorageAccount);
            queueUtil = new CloudQueueUtil(StorageAccount);
            tableUtil = new CloudTableUtil(StorageAccount);
            fileUtil  = new CloudFileUtil(StorageAccount);
            random    = new Random();

            SetCLIEnv(testContext);

            if (null == CommandAgent)
            {
                CommandAgent = AgentFactory.CreateAgent(testContext.Properties);
            }
        }
        public void GetShareSnapshot_notExistTime()
        {
            string shareName = CloudFileUtil.GenerateUniqueFileShareName();

            try
            {
                CloudFileShare share          = fileUtil.EnsureFileShareExists(shareName);
                CloudFileShare shareSnapshot1 = share.Snapshot();

                CommandAgent.GetFileShareByName(shareName, DateTime.Now.AddDays(-1));
                var result = CommandAgent.Invoke();


                CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.ResourceNotFoundFullQualifiedErrorId));
                result.AssertNoResult();
            }
            finally
            {
                try
                {
                    fileUtil.DeleteFileShareIfExists(shareName);
                }
                catch (Exception e)
                {
                    Test.Warn("Unexpected exception when cleanup file share {0}: {1}", shareName, e);
                }
            }
        }
        public void PipelineCreatingMultipleDirectoriesWhileSomeDirectoryExistsTest()
        {
            int numberOfDirectories = this.randomProvider.Next(2, 33);

            int[]    indexes = Enumerable.Range(0, numberOfDirectories).ToArray();
            string[] names   = indexes.Select(i => CloudFileUtil.GenerateUniqueDirectoryName()).ToArray();
            int      numberOfExistingDirectories = this.randomProvider.Next(1, numberOfDirectories);

            List <int> indexToBeRemoved = new List <int>(indexes);

            for (int i = 0; i < numberOfExistingDirectories; i++)
            {
                int id = this.randomProvider.Next(indexToBeRemoved.Count);
                fileUtil.EnsureDirectoryExists(this.fileShare, names[indexToBeRemoved[id]]);
                indexToBeRemoved.RemoveAt(id);
            }

            CommandAgent.NewDirectoryFromPipeline(this.fileShare.Name);
            var result = CommandAgent.Invoke(names);

            // A total number of "numberOfExistingDirectories" errors should throw while others should success.
            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.ResourceAlreadyExistsFullQualifiedErrorId), numberOfExistingDirectories);

            // Assert all directories are created
            foreach (string name in names)
            {
                fileUtil.AssertDirectoryExists(this.fileShare, name, string.Format("Directory {0} should exist after created.", name));
            }
        }
        public void CreateDirectoryUnderRootsParent()
        {
            string dirName = CloudFileUtil.GenerateUniqueDirectoryName();

            this.CreateDirectoryInternal("../" + dirName, false);
            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.InvalidResourceFullQualifiedErrorId, AssertUtil.AuthenticationFailedFullQualifiedErrorId));
        }
        public void GetShareSnapshot_ExistTime()
        {
            string shareName = CloudFileUtil.GenerateUniqueFileShareName();

            try
            {
                CloudFileShare share          = fileUtil.EnsureFileShareExists(shareName);
                CloudFileShare shareSnapshot1 = share.Snapshot();


                CommandAgent.GetFileShareByName(shareName, shareSnapshot1.SnapshotTime.Value);
                var result = CommandAgent.Invoke();
                result.AssertObjectCollection(obj => result.AssertCloudFileContainer(obj, shareName, snapshotTime: shareSnapshot1.SnapshotTime.Value), 1);
            }
            finally
            {
                try
                {
                    fileUtil.DeleteFileShareIfExists(shareName);
                }
                catch (Exception e)
                {
                    Test.Warn("Unexpected exception when cleanup file share {0}: {1}", shareName, e);
                }
            }
        }
        public void AssertFileListItems(IEnumerable <CloudFile> files, IEnumerable <CloudFileDirectory> directories)
        {
            var fileList      = new List <string>(files.Select(x => CloudFileUtil.GetFullPath(x).Trim(CloudFileUtil.PathSeparators)));
            var directoryList = new List <string>(directories.Select(x => CloudFileUtil.GetFullPath(x).Trim(CloudFileUtil.PathSeparators)));

            foreach (var psObject in this.result)
            {
                string        fullPath;
                List <string> expectedList;
                if (psObject.ImmediateBaseObject is CloudFile)
                {
                    var fileObject = (CloudFile)psObject.ImmediateBaseObject;
                    fullPath     = CloudFileUtil.GetFullPath(fileObject).Trim(CloudFileUtil.PathSeparators);
                    expectedList = fileList;
                }
                else if (psObject.ImmediateBaseObject is CloudFileDirectory)
                {
                    var directoryObject = (CloudFileDirectory)psObject.ImmediateBaseObject;
                    fullPath     = CloudFileUtil.GetFullPath(directoryObject).Trim(CloudFileUtil.PathSeparators);
                    expectedList = directoryList;
                }
                else
                {
                    throw new InvalidOperationException(string.Format("Unexpected output object: {0}.", psObject.ImmediateBaseObject));
                }

                Test.Assert(expectedList.Remove(fullPath), "Path {0} was found in the expected list.", fullPath);
            }

            Test.Assert(fileList.Count == 0, "{0} leftover items in file list.", fileList.Count);
            Test.Assert(directoryList.Count == 0, "{0} leftover items in directory list.", directoryList.Count);
        }
        private void CopyFromBlob2SASFile(Action <CloudBlobContainer> SetSourceContext)
        {
            string         destShareName = Utility.GenNameString("destshare");
            CloudFileShare destShare     = fileUtil.EnsureFileShareExists(destShareName);

            string             sourceContainerName = Utility.GenNameString("container");
            CloudBlobContainer container           = blobUtil.CreateContainer(sourceContainerName);

            try
            {
                CloudBlob sourceBlob = blobUtil.CreateRandomBlob(container, Utility.GenNameString("BlobName"));

                string destSasToken = destShare.GetSharedAccessSignature(new SharedAccessFilePolicy()
                {
                    Permissions            = SharedAccessFilePermissions.Read | SharedAccessFilePermissions.Write,
                    SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddHours(1)
                });

                object destContext = CommandAgent.GetStorageContextWithSASToken(StorageAccount, destSasToken);

                SetSourceContext(container);

                Test.Assert(CommandAgent.StartFileCopyFromBlob(sourceContainerName, sourceBlob.Name, destShareName, sourceBlob.Name, destContext), "Copy to file with sas token credential should succeed.");

                Test.Assert(CommandAgent.GetFileCopyState(destShareName, sourceBlob.Name, destContext, true), "Waiting for async copying state should succeed.");

                CloudFileUtil.ValidateCopyResult(sourceBlob, destShare.GetRootDirectoryReference().GetFileReference(sourceBlob.Name));
            }
            finally
            {
                blobUtil.RemoveContainer(sourceContainerName);
                fileUtil.DeleteFileShareIfExists(destShareName);
            }
        }
        public void CopyCrossAccountFromFile2SASFile()
        {
            string         destShareName = Utility.GenNameString("destshare");
            CloudFileShare destShare     = fileUtil2.EnsureFileShareExists(destShareName);

            string         sourceShareName = Utility.GenNameString("sourceshare");
            CloudFileShare sourceShare     = fileUtil.EnsureFileShareExists(sourceShareName);

            try
            {
                StorageFile.CloudFile sourceFile = fileUtil.CreateFile(sourceShare.GetRootDirectoryReference(), Utility.GenNameString("SourceFile"));

                string destFileName = Utility.GenNameString("destfile");
                string destSasToken = destShare.GetSharedAccessSignature(new SharedAccessFilePolicy()
                {
                    Permissions            = SharedAccessFilePermissions.Read | SharedAccessFilePermissions.Write,
                    SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddHours(1)
                });

                object destContext = CommandAgent.GetStorageContextWithSASToken(StorageAccount2, destSasToken);

                Test.Assert(CommandAgent.StartFileCopy(sourceFile, destShareName, destFileName, destContext), "Copy to file with sas token credential should fail.");

                Test.Assert(CommandAgent.GetFileCopyState(destShareName, destFileName, destContext, true), "Get file copy state should succeed.");

                CloudFileUtil.ValidateCopyResult(sourceFile, destShare.GetRootDirectoryReference().GetFileReference(destFileName));
            }
            finally
            {
                fileUtil.DeleteFileShareIfExists(sourceShareName);
                fileUtil2.DeleteFileShareIfExists(destShareName);
            }
        }
 private static IEnumerable <string> BuildShareNamesByPrefix(string prefix, int numberOfShares)
 {
     for (int i = 0; i < numberOfShares; i++)
     {
         yield return(string.Concat(prefix, CloudFileUtil.GenerateUniqueFileShareName()));
     }
 }
Beispiel #11
0
        private void UploadMultipleThroughPipeline(int numberOfFiles, int numberOfExistingFiles)
        {
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

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

            int[]    indexes = Enumerable.Range(0, numberOfFiles).ToArray();
            string[] names   = indexes.Select(i => CloudFileUtil.GenerateUniqueFileName()).ToArray();

            List <int> indexToBeRemoved = new List <int>(indexes);

            for (int i = 0; i < numberOfExistingFiles; i++)
            {
                int id = this.randomProvider.Next(indexToBeRemoved.Count);
                fileUtil.CreateFile(this.fileShare, names[indexToBeRemoved[id]]);
                indexToBeRemoved.RemoveAt(id);
            }

            CommandAgent.UploadFilesFromPipeline(this.fileShare.Name, localFilePath);
            var result = CommandAgent.Invoke(names);

            // Assert all files are created
            foreach (string name in names)
            {
                fileUtil.AssertFileExists(this.fileShare, name, string.Format("File {0} should exist after created.", name));
            }
        }
        public void GetFileShareUsageTest()
        {
            string fileShareName = CloudFileUtil.GenerateUniqueFileShareName();
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            var    fileShare     = fileUtil.EnsureFileShareExists(fileShareName);

            try
            {
                CommandAgent.GetFileShareByName(fileShareName);

                var result = CommandAgent.Invoke();

                CommandAgent.AssertNoError();
                result.AssertObjectCollection(obj => result.AssertCloudFileContainer(obj, fileShareName), 1);

                fileUtil.CreateFile(fileShare.GetRootDirectoryReference(), cloudFileName);

                CommandAgent.Clear();
                CommandAgent.GetFileShareByName(fileShareName);

                result = CommandAgent.Invoke();
                CommandAgent.AssertNoError();
                result.AssertObjectCollection(obj => result.AssertCloudFileContainer(obj, fileShareName, 1), 1);
            }
            finally
            {
                fileUtil.DeleteFileShareIfExists(fileShareName);
            }
        }
        public void GetShareSnapshot_CheckIncludeSnapshot()
        {
            string shareName = CloudFileUtil.GenerateUniqueFileShareName();
            string fileName  = CloudFileUtil.GenerateUniqueFileName();

            try
            {
                CloudFileShare share          = fileUtil.EnsureFileShareExists(shareName);
                CloudFileShare shareSnapshot1 = share.Snapshot();
                fileUtil.CreateFile(share, fileName);
                CloudFileShare shareSnapshot2 = share.Snapshot();

                CommandAgent.GetFileShareByName("");
                var result = CommandAgent.Invoke();

                List <DateTimeOffset> snapshotTimes = new List <DateTimeOffset>();
                snapshotTimes.Add(shareSnapshot1.SnapshotTime.Value);
                snapshotTimes.Add(shareSnapshot2.SnapshotTime.Value);

                result.AssertCloudFileContainersExist(shareName, snapshotTimes);
            }
            finally
            {
                try
                {
                    fileUtil.DeleteFileShareIfExists(shareName);
                }
                catch (Exception e)
                {
                    Test.Warn("Unexpected exception when cleanup file share {0}: {1}", shareName, e);
                }
            }
        }
Beispiel #14
0
        public void DownloadBatchFilesFromListingResult()
        {
            int numberOfFilesToDownload = this.randomProvider.Next(5, 20);
            List <CloudFile> files      = new List <CloudFile>();
            List <string>    fileNames  = new List <string>();

            for (int i = 0; i < numberOfFilesToDownload; i++)
            {
                string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
                string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());
                FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
                files.Add(fileUtil.CreateFile(this.fileShare, cloudFileName, localFilePath));
                File.Delete(localFilePath);
                fileNames.Add(cloudFileName.ToLowerInvariant());
            }

            DirectoryInfo localDir = new DirectoryInfo(Test.Data.Get("TempDir"));

            CommandAgent.GetFile(this.fileShare);
            ((PowerShellAgent)CommandAgent).PowerShellSession.AddCommand("Get-AzureStorageFileContent");
            ((PowerShellAgent)CommandAgent).PowerShellSession.AddParameter("Destination", localDir.FullName);
            CommandAgent.Invoke();
            CommandAgent.AssertNoError();

            var localFilesInfo = localDir.GetFiles();

            foreach (var fileInfo in localFilesInfo)
            {
                fileNames.Remove(fileInfo.Name.ToLowerInvariant());
            }

            Test.Assert(fileNames.Count == 0, "All files should be downloaded while missing: {0}", string.Join(",", fileNames));
        }
Beispiel #15
0
        public void DownloadFileUsingRelativePathAfterChangedDefaultLocation()
        {
            string currentPath = CommandAgent.GetCurrentLocation();

            try
            {
                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);
                CommandAgent.ChangeLocation(Test.Data.Get("TempDir"));
                UploadAndDownloadFileInternal(
                    sourceFile,
                    FileUtil.GetFileContentMD5(localFilePath),
                    destination => CommandAgent.DownloadFile(this.fileShare, cloudFileName, ".", true));
                var result = CommandAgent.Invoke();
                result.AssertNoResult();
                Test.Assert(new FileInfo(Path.Combine(Test.Data.Get("TempDir"), cloudFileName)).Exists, "File should exist after downloaded.");
            }
            finally
            {
                CommandAgent.Clear();
                CommandAgent.ChangeLocation(currentPath);
            }
        }
        public void PipelineMultipleShareNamesToRemoveTest()
        {
            // TODO: Generate more random names for file shares after the
            // naming rules is settled down.
            int numberOfShares = this.randomProvider.Next(2, 33);

            string[] names = Enumerable.Range(0, numberOfShares)
                             .Select(i => CloudFileUtil.GenerateUniqueFileShareName()).ToArray();
            foreach (var name in names)
            {
                fileUtil.EnsureFileShareExists(name);
            }

            try
            {
                CommandAgent.RemoveFileShareFromPipeline();
                var result = CommandAgent.Invoke(names);

                CommandAgent.AssertNoError();
                result.AssertNoResult();
            }
            finally
            {
                foreach (string fileShareName in names)
                {
                    fileUtil.DeleteFileShareIfExists(fileShareName);
                }
            }
        }
        private void CopyFromFile2File(Action <CloudFileShare> SetSourceContext, Func <CloudFileShare, object> getDestContext)
        {
            string         destShareName = Utility.GenNameString("destshare");
            CloudFileShare destShare     = fileUtil.EnsureFileShareExists(destShareName);

            string         sourceShareName = Utility.GenNameString("sourceshare");
            CloudFileShare sourceShare     = fileUtil.EnsureFileShareExists(sourceShareName);

            try
            {
                StorageFile.CloudFile sourceFile = fileUtil.CreateFile(sourceShare.GetRootDirectoryReference(), Utility.GenNameString("SourceFile"));

                object destContext = getDestContext(destShare);

                SetSourceContext(sourceShare);

                string destFileName = Utility.GenNameString("destfile");
                Test.Assert(CommandAgent.StartFileCopyFromFile(sourceShareName, sourceFile.Name, destShareName, destFileName, destContext), "Copy to file with sas token credential should succeed.");

                var destFile = fileUtil.GetFileReference(destShare.GetRootDirectoryReference(), destFileName);

                Test.Assert(CommandAgent.GetFileCopyState(destFile, destContext, true), "Get file copy state should succeed.");

                CloudFileUtil.ValidateCopyResult(sourceFile, destFile);
            }
            finally
            {
                fileUtil.DeleteFileShareIfExists(sourceShareName);
                fileUtil.DeleteFileShareIfExists(destShareName);
            }
        }
        public void CreateDirectoryWhichHasJustBeenDeleted()
        {
            string dirName   = CloudFileUtil.GenerateUniqueDirectoryName();
            var    directory = fileUtil.EnsureDirectoryExists(this.fileShare, dirName);

            directory.Delete();
            this.CreateDirectoryInternal(dirName);
        }
        public void GetShareByPrefixUsingWildCardTest()
        {
            string shareName = string.Concat("*", CloudFileUtil.GenerateUniqueFileShareName());

            CommandAgent.GetFileShareByPrefix(shareName);
            CommandAgent.Invoke();
            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.InvalidArgumentFullQualifiedErrorId));
        }
Beispiel #20
0
        public void UploadFileFromSubDirectoryOfRootTest()
        {
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);
            CommandAgent.UploadFile(this.fileShare, localFilePath, "../a");
            CommandAgent.Invoke();
            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.InvalidResourceFullQualifiedErrorId, AssertUtil.AuthenticationFailedFullQualifiedErrorId));
        }
        public void AssertCloudFileDirectory(object directoryObj, string directoryPath)
        {
            var directoryObject = ((PSObject)directoryObj).ImmediateBaseObject as CloudFileDirectory;

            Test.Assert(directoryObject != null, "Output object should be an instance of CloudFileDirectory.");
            string fullPath = CloudFileUtil.GetFullPath(directoryObject).Trim(CloudFileUtil.PathSeparators);

            Test.Assert(fullPath.Equals(directoryPath.Trim(CloudFileUtil.PathSeparators), StringComparison.OrdinalIgnoreCase), "Prefix of the directory object should match the given parameter. Expected: {0}, Actual: {1}", directoryPath, fullPath);
        }
        public void AssertCloudFileDirectory(object directoryObj, List <string> directoryPathes)
        {
            var directoryObject = ((PSObject)directoryObj).ImmediateBaseObject as CloudFileDirectory;

            Test.Assert(directoryObject != null, "Output object should be an instance of CloudFileDirectory.");
            string fullPath = CloudFileUtil.GetFullPath(directoryObject).Trim(CloudFileUtil.PathSeparators);

            Test.Assert(directoryPathes.Remove(fullPath), "Prefix of the directory object '{0}' should be within the given collection.", fullPath);
        }
        public void CreateExistingDirectoryTest()
        {
            string dirName   = CloudFileUtil.GenerateUniqueDirectoryName();
            var    directory = fileUtil.EnsureDirectoryExists(this.fileShare, dirName);

            CommandAgent.NewDirectory(this.fileShare, dirName);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.ResourceAlreadyExistsFullQualifiedErrorId));
        }
Beispiel #24
0
        public void DownloadingNonExistingFile()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            var    file          = fileUtil.DeleteFileIfExists(this.fileShare, cloudFileName);

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

            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.InvalidOperationExceptionFullQualifiedErrorId, AssertUtil.PathNotFoundFullQualifiedErrorId, AssertUtil.ResourceNotFoundFullQualifiedErrorId));
        }
        public void RemoveDirectoryUnderNonExistingShareTest()
        {
            string shareName = CloudFileUtil.GenerateUniqueFileShareName();
            string dir       = CloudFileUtil.GenerateUniqueDirectoryName();

            fileUtil.DeleteFileShareIfExists(shareName);
            CommandAgent.RemoveDirectory(shareName, dir);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.ShareNotFoundFullQualifiedErrorId));
        }
        public void RemoveNonExistingFile()
        {
            string fileName = CloudFileUtil.GenerateUniqueFileName();

            fileUtil.DeleteFileIfExists(this.fileShare, fileName);

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

            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.ResourceNotFoundFullQualifiedErrorId));
        }
Beispiel #27
0
        public void CreateDirectoryWithNoPath_Directory()
        {
            var dir = fileUtil.EnsureDirectoryExists(this.fileShare, CloudFileUtil.GenerateUniqueDirectoryName());

            CommandAgent.SetVariable("dir", dir);
            ((PowerShellAgent)CommandAgent).PowerShellSession.AddScript("New-AzureStorageDirectory -Directory $dir");
            var result = CommandAgent.Invoke();

            result.AssertNoResult();
            CommandAgent.AssertErrors(err => err.AssertError(AssertUtil.MissingMandatoryParameterFullQualifiedErrorId));
        }
Beispiel #28
0
        public void CreateDirectoryAndListThroughPSHTest()
        {
            string directoryName = CloudFileUtil.GenerateUniqueDirectoryName();

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

            CommandAgent.AssertNoError();
            result.AssertObjectCollection(obj => obj.AssertCloudFileDirectory(directoryName));
        }
Beispiel #29
0
        public void CreateDirectoryAndListThroughSMBTest()
        {
            string directoryName = CloudFileUtil.GenerateUniqueDirectoryName();

            CommandAgent.NewDirectory(this.fileShare, directoryName);
            CommandAgent.Invoke();
            CommandAgent.AssertNoError();
            SMBValidationRetry(
                () => this.mountedShareRoot.GetDirectories().Select(x => x.Name).Contains(directoryName),
                "list the newly created directory through SMB protocol");
        }
        public void CreateDirectoryUnderExistingDirectory()
        {
            string dirName    = CloudFileUtil.GenerateUniqueDirectoryName();
            var    directory  = fileUtil.EnsureDirectoryExists(this.fileShare, dirName);
            string subDirName = CloudFileUtil.GenerateUniqueDirectoryName();
            string fullPath   = CloudFileUtil.GetFullPath(directory.GetDirectoryReference(subDirName));

            this.CreateDirectoryInternal(
                () => CommandAgent.NewDirectory(directory, subDirName),
                fullPath.TrimEnd('/'));
        }