Skip to content

Instantly share code, notes, and snippets.

@stijnmoreels
Last active August 7, 2023 05:44
Show Gist options
  • Select an option

  • Save stijnmoreels/57515751f0b17022e11271d12c242e35 to your computer and use it in GitHub Desktop.

Select an option

Save stijnmoreels/57515751f0b17022e11271d12c242e35 to your computer and use it in GitHub Desktop.
public class MyTestContext
{
private readonly Arg<string> _tag = Arg.String.Default(Gen.Tag.Generate());
private readonly Arg<DateTimeOffset> _before = Arg.Date.Ignore();
public static MyTestContext Given()
{
return new MyTestContext();
}
public void WhenTag(string tag)
{
_tag.TryOverwrite(tag);
_tag.PreserveValue();
}
public void WhenRequest(string tag = null, DateTimeOffset? before = null)
{
_tag.TryOverwrite(tag);
_before.TryOverwrite(before);
}
public async Task ShouldRespondWithAsync(Func<HttpResponseMessage, Task> assertionAsync)
{
var request = new HttpRequestMessage(HttpMethod.Get, $"http://localhost:1234/api/app?tag={_tag}&before={_before}");
// Ignore this; out of scope.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment