https://github.com/verifytests/verify.brighter
Adds Verify support for verifying Brighter.
https://github.com/verifytests/verify.brighter
Last synced: 10 months ago
JSON representation
Adds Verify support for verifying Brighter.
- Host: GitHub
- URL: https://github.com/verifytests/verify.brighter
- Owner: VerifyTests
- License: mit
- Created: 2023-04-09T02:47:59.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-30T03:46:09.000Z (about 2 years ago)
- Last Synced: 2024-05-01T09:37:51.362Z (about 2 years ago)
- Language: C#
- Homepage:
- Size: 211 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license.txt
Awesome Lists containing this project
README
#
Verify.Brighter
[](https://github.com/orgs/VerifyTests/discussions)
[](https://ci.appveyor.com/project/SimonCropp/Verify-Brighter)
[](https://www.nuget.org/packages/Verify.Brighter/)
Adds [Verify](https://github.com/VerifyTests/Verify) support for verifying [Brighter](https://www.goparamore.io/).
**See [Milestones](../../milestones?state=closed) for release notes.**
## NuGet package
https://nuget.org/packages/Verify.Brighter/
## Usage
```cs
[ModuleInitializer]
public static void Init() =>
VerifyBrighter.Initialize();
```
snippet source | anchor
## Handler
Given the handler:
```cs
public class Handler(IAmACommandProcessor processor) :
RequestHandlerAsync
{
public override async Task HandleAsync(
Message message,
Cancel cancel = default)
{
await processor.SendAsync(new MyCommand("Some data"));
await processor.PublishAsync(new MyEvent("Some other data"));
return await base.HandleAsync(message);
}
}
```
snippet source | anchor
## Test
Pass in instance of `RecordingMessageContext` in to the `Handle` method and then `Verify` that instance.
```cs
[Fact]
public async Task HandlerTest()
{
var context = new RecordingCommandProcessor();
var handler = new Handler(context);
await handler.HandleAsync(new Message("value"));
await Verify(context);
}
```
snippet source | anchor
Will result in:
```txt
{
Send: MyCommand: {
Property: Some data
},
Publish: MyEvent: {
Property: Some other data
}
}
```
snippet source | anchor
## Icon
[Cannon](https://thenounproject.com/term/cannon/2181690/) from [The Noun Project](https://thenounproject.com/).