Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created April 15, 2026 12:51
Show Gist options
  • Select an option

  • Save dcomartin/f60e7020b3f962709ad0757236b46ece to your computer and use it in GitHub Desktop.

Select an option

Save dcomartin/f60e7020b3f962709ad0757236b46ece to your computer and use it in GitHub Desktop.
public class Tests
{
[Fact]
public async Task Lookup_returns_mapped_result_when_response_is_successful()
{
var json = """
{
"year": 2026,
"make": "Ford",
"model": "F-150"
}
""";
var handler = new StubHttpMessageHandler(_ =>
new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(json, Encoding.UTF8, "application/json")
});
var httpClient = new HttpClient(handler);
var sut = new VinDecoder(httpClient);
var result = await sut.Lookup("123456789");
Assert.Equal(2026, result.Year);
Assert.Equal("Ford", result.Make);
Assert.Equal("F-150", result.Model);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment