Extends Verify to allow verification of Flurl bits.
See Milestones for release notes.
https://nuget.org/packages/Verify.Flurl/
Call VerifyFlurl.Initialize()
in a [ModuleInitializer]
.
public static class ModuleInitializer
{
[ModuleInitializer]
public static void Initialize() =>
VerifyFlurl.Initialize();
}
Alternatively, use VerifierSettings.InitializePlugins()
to initialize all Verify plugins with default settings.
public static class ModuleInitializer
{
[ModuleInitializer]
public static void Initialize() =>
VerifierSettings.InitializePlugins();
}
Given any calls to HttpTest
, those call can be verified as follows:
[Fact]
public async Task Usage()
{
using var httpTest = new HttpTest();
httpTest.RespondWith("OK");
await "http://api.mysite.com/".GetAsync();
await "http://api.mysite.com/".PostAsync(new StringContent("the content"));
await Verify(httpTest);
}
Results in:
[
{
Request: http://api.mysite.com/,
Response: {
Status: 200 OK,
Content: {
Headers: {
Content-Type: text/plain; charset=utf-8
},
Value: OK
}
}
},
{
Request: {
Method: POST,
Uri: http://api.mysite.com/,
Content: {
Headers: {
Content-Type: text/plain; charset=utf-8
},
Value: the content
}
},
Response: {
Status: 200 OK,
Content: {
Headers: {
Content-Type: text/plain; charset=utf-8
},
Value: OK
}
}
}
]