Skip to content

Adds Verify support for verifying Brighter.

License

Notifications You must be signed in to change notification settings

VerifyTests/Verify.Brighter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Verify.Brighter

Discussions Build status NuGet Status

Adds Verify support for verifying Brighter.

See Milestones for release notes.

NuGet package

https://nuget.org/packages/Verify.Brighter/

Usage

[ModuleInitializer]
public static void Init() =>
    VerifyBrighter.Initialize();

snippet source | anchor

Handler

Given the handler:

public class Handler(IAmACommandProcessor processor) :
    RequestHandlerAsync<Message>
{
    public override async Task<Message> 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.

[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:

{
  Send: MyCommand: {
    Property: Some data
  },
  Publish: MyEvent: {
    Property: Some other data
  }
}

snippet source | anchor

Icon

Cannon from The Noun Project.

About

Adds Verify support for verifying Brighter.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages