Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created January 19, 2017 06:25
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 justinyoo/2bc32a57005d64b3288361a22d17aa49 to your computer and use it in GitHub Desktop.
Save justinyoo/2bc32a57005d64b3288361a22d17aa49 to your computer and use it in GitHub Desktop.
Testing Precompiled Azure Functions
public class MyHttpTriggerTest
{
[Theory]
[InlineData("Azure")]
[InlineData("Dependency")]
public async void Given_Dependency_HttpTrigger_ShouldReturn_Result(string name)
{
// Arrange
var req = new HttpRequestMessage()
{
Content = new StringContent(string.Empty),
RequestUri = new Uri($"http://localhost?name={name}")
};
var log = new TraceMonitor();
// Act
var result = await MyHttpTrigger.Run(req, log).ConfigureAwait(false);
// Assert
var content = await result.Content.ReadAsStringAsync().ConfigureAwait(false);
content.Should().ContainEquivalentOf($"Hello {name}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment