-
-
Save johndowns/91e3a6f0a3d14fbff40aa3b1f2056639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(nameof(FunctionTestCollection))] | |
public class HelloQueueFunctionTest | |
{ | |
private readonly FunctionTestFixture _fixture; | |
private readonly CloudQueue _queue = CloudStorageAccount | |
.Parse(ConfigurationHelper.Settings.StorageConnectionString) | |
.CreateCloudQueueClient() | |
.GetQueueReference("greetings"); | |
public HelloQueueFunctionTest(FunctionTestFixture fixture) | |
{ | |
_fixture = fixture; | |
} | |
[Fact] | |
public void Hello_Queue_Function_Test() | |
{ | |
this.BDDfy(); | |
} | |
private async Task Given_The_Greetings_Queue_Exists_And_Is_Empty() | |
{ | |
await _queue.CreateIfNotExistsAsync(); | |
await _queue.ClearAsync(); | |
} | |
private async Task When_The_HelloQueue_Function_Is_Invoked() | |
{ | |
var response = await _fixture.Client.GetAsync("api/HelloQueue?name=James+Bond"); | |
response.EnsureSuccessStatusCode(); | |
} | |
private async Task Then_The_Enqueued_Message_Should_Include_The_Caller_Name() | |
{ | |
var message = await _queue.GetMessageAsync(); | |
Assert.EndsWith("James Bond", message.AsString); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment