示例#1
0
        public async Task TestUri()
        {
            CloudBlockBlob blob = await CreateEmptyBlob("blob");
            AzureBlob azureBlob = new AzureBlob(blob);

            Assert.AreEqual(blob.Uri.ToString(), azureBlob.Uri);
        }
示例#2
0
 public Task<IRemoteFile> GetFile(string name)
 {
     return Task.Run(() =>
     {
         IRemoteFile file = new AzureBlob(_blobContainer.GetBlockBlobReference(name));
         return file;
     });
 }
示例#3
0
 public Task <IRemoteFile> GetFile(string name)
 {
     return(Task.Run(() =>
     {
         IRemoteFile file = new AzureBlob(_cloudBlobDirectory.GetBlockBlobReference(name));
         return file;
     }));
 }
示例#4
0
        public async Task TestName()
        {
            string blobName = "blob";
            CloudBlockBlob blob = await CreateEmptyBlob(blobName);
            AzureBlob azureBlob = new AzureBlob(blob);

            Assert.AreEqual(blobName, azureBlob.Name);
        }
示例#5
0
 public Task <IRemoteFile> GetFile(string name)
 {
     return(Task.Run(() =>
     {
         IRemoteFile file = new AzureBlob(_blobContainer.GetBlockBlobReference(name));
         return file;
     }));
 }
示例#6
0
        public async Task TestDownloadText()
        {
            string text = "some text in the blob";
            CloudBlockBlob blob = await CreateEmptyBlob("blob");
            blob.UploadText(text);

            AzureBlob azureBlob = new AzureBlob(blob);
            Assert.AreEqual(text, azureBlob.DownloadText().Result);
        }
示例#7
0
        public Task<IRemoteFile> GetFile(string name)
        {
            return Task.Run(() =>
            {
                IRemoteFile file = new AzureBlob(_cloudBlobDirectory.GetBlockBlobReference(name));
                return file;

            });
        }
示例#8
0
        public async Task TestNameOfBlobInDirectory()
        {
            string blobName = "blob";

            CloudBlobContainer container = _blobClient.GetContainerReference("container");
            container.CreateIfNotExists();
            CloudBlobDirectory directory = container.GetDirectoryReference("directory");
            CloudBlockBlob blob = directory.GetBlockBlobReference(blobName);
            await BlobUtils.CreateEmptyBlob(blob);
            AzureBlob azureBlob = new AzureBlob(blob);

            Assert.AreEqual(blobName, azureBlob.Name);
        }
示例#9
0
        public async Task TestDownload()
        {
            CloudBlockBlob blob = await CreateEmptyBlob("blob");
            AzureBlob azureBlob = new AzureBlob(blob);

            string path = Path.Combine(Path.GetTempPath(), "azureblobtest");
            File.Delete(path);

            await azureBlob.Download(path);
            Assert.IsTrue(File.Exists(path));
        }
示例#10
0
        public async Task TestExists()
        {
            CloudBlockBlob blob = await CreateEmptyBlob("blob");
            AzureBlob azureBlob = new AzureBlob(blob);

            Assert.IsTrue(await azureBlob.Exists());

            blob.Delete();
            Assert.IsFalse(await azureBlob.Exists());
        }