Skip to content

Instantly share code, notes, and snippets.

@johndowns
Created November 7, 2018 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johndowns/91e3a6f0a3d14fbff40aa3b1f2056639 to your computer and use it in GitHub Desktop.
Save johndowns/91e3a6f0a3d14fbff40aa3b1f2056639 to your computer and use it in GitHub Desktop.
(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