public async void PutBlockBlobAsync_LeasedBlobWithNoLeaseGiven_ThrowsLeaseIdMissingAzureException() { var containerName = _util.GenerateSampleContainerName(_runId); var blobName = _util.GenerateSampleBlobName(_runId); _util.CreateContainer(containerName); _util.CreateBlockBlob(containerName, blobName); _util.LeaseBlob(containerName, blobName); IBlobServiceClient client = new BlobServiceClient(AccountSettings); var data = Encoding.UTF8.GetBytes("unit test content"); await client.PutBlockBlobAsync(containerName, blobName, data); // throws exception }
public async void PutBlockBlobAsync_LeasedBlobWithCorrectLeaseId_UploadsBlobSuccessfully() { var containerName = _util.GenerateSampleContainerName(_runId); var blobName = _util.GenerateSampleBlobName(_runId); _util.CreateContainer(containerName); _util.CreateBlockBlob(containerName, blobName); var correctLease = _util.LeaseBlob(containerName, blobName); IBlobServiceClient client = new BlobServiceClient(AccountSettings); var data = Encoding.UTF8.GetBytes("unit test content"); await client.PutBlockBlobAsync(containerName, blobName, data, leaseId: correctLease); _util.AssertBlobExists(containerName, blobName, BlobType.BlockBlob); }
public async Task PutBlockBlobAsync_WithIncorrectContentMD5_ThrowsMD5MismatchAzureException() { var containerName = _util.GenerateSampleContainerName(_runId); var blobName = _util.GenerateSampleBlobName(_runId); _util.CreateContainer(containerName); IBlobServiceClient client = new BlobServiceClient(AccountSettings); var data = Encoding.UTF8.GetBytes("unit test content"); var someOtherData = Encoding.UTF8.GetBytes("different content"); var incorrectContentMD5 = Convert.ToBase64String((MD5.Create()).ComputeHash(someOtherData)); await client.PutBlockBlobAsync(containerName, blobName, data, contentMD5: incorrectContentMD5); // expects exception }
public async Task PutBlockBlobAsync_RequiredArgsOnly_UploadsBlobSuccessfully() { var containerName = _util.GenerateSampleContainerName(_runId); var blobName = _util.GenerateSampleBlobName(_runId); _util.CreateContainer(containerName); IBlobServiceClient client = new BlobServiceClient(AccountSettings); var data = Encoding.UTF8.GetBytes("unit test content"); await client.PutBlockBlobAsync(containerName, blobName, data); _util.AssertBlobExists(containerName, blobName, BlobType.BlockBlob); }
public async void PutBlockBlobAsync_LeasedBlobWithInvalidLeaseGiven_ThrowsArgumentException() { var containerName = _util.GenerateSampleContainerName(_runId); var blobName = _util.GenerateSampleBlobName(_runId); IBlobServiceClient client = new BlobServiceClient(AccountSettings); var data = Encoding.UTF8.GetBytes("unit test content"); await client.PutBlockBlobAsync(containerName, blobName, data, leaseId: InvalidLeaseId); // throws exception }
public async void PutBlockBlobAsync_LeasedBlobWithIncorrectLeaseGiven_ThrowsLeaseIdMismatchWithBlobOperationAzureException() { var containerName = GenerateSampleContainerName(); var blobName = GenerateSampleBlobName(); CreateContainer(containerName); CreateBlockBlob(containerName, blobName); LeaseBlob(containerName, blobName); IBlobServiceClient client = new BlobServiceClient(AccountSettings); var data = Encoding.UTF8.GetBytes("unit test content"); await client.PutBlockBlobAsync(containerName, blobName, data, leaseId: GetGuidString()); // throws exception }