Skip to content

Instantly share code, notes, and snippets.

Last active August 22, 2019 19:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
namespace Domain.Tests.Unit.Stubs
internal class SubmissionServiceHttpHandlerStub : HttpMessageHandler
private Dictionary<string, Payload> _requestPayload;
protected override async Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request,
CancellationToken cancellationToken)
_payload = JsonConvert.DeserializeObject<Dictionary<string,
await request.Content.ReadAsStringAsync());
// Assume that submission was successful,
// construct the response payload
var result = ConstructResponsePayload(_payload)
return new HttpResponseMessage(HttpStatusCode.OK)
Content = new StringContent(JsonConvert.SerializeObject(result))
internal Payload PayloadDto(
string key) =>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment