https://github.com/verifytests/verify.flurl
https://github.com/verifytests/verify.flurl
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/verifytests/verify.flurl
- Owner: VerifyTests
- License: mit
- Created: 2024-03-17T08:18:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-06-09T09:14:45.000Z (about 1 year ago)
- Last Synced: 2025-06-09T10:24:41.116Z (about 1 year ago)
- Language: C#
- Size: 198 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license.txt
- Code of conduct: code_of_conduct.md
Awesome Lists containing this project
README
#
Verify.Flurl
[](https://github.com/orgs/VerifyTests/discussions)
[](https://ci.appveyor.com/project/SimonCropp/verify-flurl)
[](https://www.nuget.org/packages/Verify.Flurl/)
Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of [Flurl](https://flurl.dev/) bits.
**See [Milestones](../../milestones?state=closed) for release notes.**
## Sponsors
### Entity Framework Extensions
[Entity Framework Extensions](https://entityframework-extensions.net/) is a major sponsor and is proud to contribute to the development this project.
[](https://entityframework-extensions.net)
## NuGet
* https://nuget.org/packages/Verify.Flurl
## Usage
### Initialize
Call `VerifyFlurl.Initialize()` in a `[ModuleInitializer]`.
```cs
public static class ModuleInitializer
{
[ModuleInitializer]
public static void Initialize() =>
VerifyFlurl.Initialize();
}
```
Alternatively, use `VerifierSettings.InitializePlugins()` to initialize all Verify plugins with default settings.
```cs
public static class ModuleInitializer
{
[ModuleInitializer]
public static void Initialize() =>
VerifierSettings.InitializePlugins();
}
```
### Test
Given any calls to `HttpTest`, those call can be verified as follows:
```cs
[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);
}
```
snippet source | anchor
Results in:
```txt
[
{
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
}
}
}
]
```
snippet source | anchor