Created
August 14, 2023 18:16
-
-
Save mxmissile/3e341ec345e17337b0a8674ecaf69c78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestClass] | |
public class WolverineTests | |
{ | |
[TestMethod] | |
public async Task cascade_test() | |
{ | |
using var host = await Host.CreateDefaultBuilder() | |
.UseWolverine((context, opts) => { }) | |
.StartAsync(); | |
var bus = host.Services.GetRequiredService<IMessageBus>(); | |
await bus.InvokeAsync(new CascadeCommand()); | |
} | |
} | |
public record CascadeCommand; | |
public record Step1Result; | |
public record Step2Result; | |
public record Step3Result; | |
public class Step1Handler | |
{ | |
public Step1Result Consume(CascadeCommand cmd) | |
{ | |
Console.WriteLine("handle step 1"); | |
return new Step1Result(); | |
} | |
} | |
public class Step2Handler | |
{ | |
public Step2Result Consume(Step1Result cmd) | |
{ | |
Console.WriteLine("handle step 2"); | |
return new Step2Result(); | |
} | |
} | |
public class Step3Handler | |
{ | |
public Step3Result Consume(Step2Result cmd) | |
{ | |
Console.WriteLine("handle step 3"); | |
return new Step3Result(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment