using System.Threading.Tasks;
using Flurl.Http.Testing;
static async Task Main(string[] args)
public static async Task TestGetData()
using (var httpTest = new HttpTest())
httpTest.RespondWith("json result", 200);
var result = await GetData();
httpTest.ShouldHaveExactCall("https://flurltestservice.azurewebsites.net/v2/users?AccessToken=token&ResultsCounts=20")
.WithVerb(HttpMethod.Get)
Console.WriteLine("Test completed.");
private static async Task<string> GetData()
var result = await "https://flurltestservice.azurewebsites.net/"
.AppendPathSegment("users")
public static class HttpCallAssertionExtensions
public static HttpCallAssertion ShouldHaveExactCall(this HttpTest test, string exactUrl)
test.CallLog.First().FlurlRequest.Url.ToString().Should().Be(exactUrl);
return new HttpCallAssertion(test.CallLog);