FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

VerifyTests/Verify.Brighter: Adds Verify support for verifying Brighter. · GitHub

Latest commit

 

History

624 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Verify.Brighter

Adds Verify support for verifying Brighter.

See Milestones for release notes.

Sponsors

Entity Framework Extensions

Entity Framework Extensions is a major sponsor and is proud to contribute to the development this project.

Developed using JetBrains IDEs

NuGet

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: SendRecord: {
    Request: {
      Property: Some data,
      Id: {
        Value: Guid_1
      }
    },
    ContinueOnCapturedContext: true
  },
  Publish: PublishRecord: {
    Request: {
      Property: Some other data,
      Id: {
        Value: Guid_2
      }
    },
    ContinueOnCapturedContext: true
  }
}

snippet source | anchor

Icon

Cannon from The Noun Project.

About

Adds Verify support for verifying Brighter.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL