private void FileDirectoryEscapingTest(string directoryName, string fileName) { CloudFileClient service = GenerateCloudFileClient(); CloudFileShare share = GetRandomShareReference(); try { share.Create(); string text = Guid.NewGuid().ToString(); // Create from CloudFileShare. CloudFileDirectory directory = share.GetRootDirectoryReference().GetDirectoryReference(directoryName); directory.Create(); CloudFile originalFile = directory.GetFileReference(fileName); originalFile.Create(0); // List directories from share. IListFileItem directoryFromShareListingFiles = share.GetRootDirectoryReference().ListFilesAndDirectories().First(); Assert.AreEqual(directory.Uri, directoryFromShareListingFiles.Uri); // List files from directory. IListFileItem fileFromDirectoryListingFiles = directory.ListFilesAndDirectories().First(); Assert.AreEqual(originalFile.Uri, fileFromDirectoryListingFiles.Uri); // Check Name Assert.AreEqual <string>(fileName, originalFile.Name); // Absolute URI access from CloudFile CloudFile fileInfo = new CloudFile(originalFile.Uri, service.Credentials); fileInfo.FetchAttributes(); // Access from CloudFileDirectory CloudFileDirectory cloudFileDirectory = share.GetRootDirectoryReference().GetDirectoryReference(directoryName); CloudFile fileFromCloudFileDirectory = cloudFileDirectory.GetFileReference(fileName); Assert.AreEqual(fileInfo.Uri, fileFromCloudFileDirectory.Uri); } finally { share.Delete(); } }