public void Blob_IfBoundToTextWriter_CreatesBlob() { // Arrange const string expectedContent = "message"; IStorageAccount account = CreateFakeStorageAccount(); IStorageQueue triggerQueue = CreateQueue(account, TriggerQueueName); triggerQueue.AddMessage(triggerQueue.CreateMessage(expectedContent)); // Act RunTrigger(account, typeof(BindToTextWriterProgram)); // Assert IStorageBlobContainer container = GetContainerReference(account, ContainerName); Assert.True(container.Exists()); IStorageBlockBlob blob = container.GetBlockBlobReference(BlobName); Assert.True(blob.Exists()); string content = blob.DownloadText(); Assert.Equal(expectedContent, content); }
public void Blob_IfBoundToCloudBlockBlob_BindsAndCreatesContainerButNotBlob() { // Arrange IStorageAccount account = CreateFakeStorageAccount(); IStorageQueue triggerQueue = CreateQueue(account, TriggerQueueName); triggerQueue.AddMessage(triggerQueue.CreateMessage("ignore")); // Act CloudBlockBlob result = RunTrigger <CloudBlockBlob>(account, typeof(BindToCloudBlockBlobProgram), (s) => BindToCloudBlockBlobProgram.TaskSource = s); // Assert Assert.NotNull(result); Assert.Equal(BlobName, result.Name); Assert.NotNull(result.Container); Assert.Equal(ContainerName, result.Container.Name); IStorageBlobContainer container = GetContainerReference(account, ContainerName); Assert.True(container.Exists()); IStorageBlockBlob blob = container.GetBlockBlobReference(BlobName); Assert.False(blob.Exists()); }