An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# Verify.Brighter

[![Discussions](https://img.shields.io/badge/Verify-Discussions-yellow?svg=true&label=)](https://github.com/orgs/VerifyTests/discussions)
[![Build status](https://ci.appveyor.com/api/projects/status/qwqcg22d7v2awni7?svg=true)](https://ci.appveyor.com/project/SimonCropp/Verify-Brighter)
[![NuGet Status](https://img.shields.io/nuget/v/Verify.Brighter.svg)](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/).