Пример #1
0
        public async Task TestUploadFile()
        {
            var container = _blobClient.GetContainerReference("container");

            container.CreateIfNotExists();

            var testDirPath     = GetTestDirPath(nameof(TestUploadFile));
            var testFilePath    = Path.Combine(testDirPath, "testFile.txt");
            var testFileContent = "TestUploadFileToBlob";

            File.WriteAllText(testFilePath, testFileContent);

            var testBlobPath = "testBlob.txt";
            await BlobUtils.UploadFile(testFilePath, container, testBlobPath);

            var blob = container.GetBlockBlobReference(testBlobPath);

            Assert.True(await blob.ExistsAsync());
            Assert.Equal(testFileContent, await blob.DownloadTextAsync());
        }