public async Task When_command_handler_registered_in_child_kernel_and_command_sent_to_parent_then_handler_is_executed() { using var compositeKernel = new CompositeKernel(); var childKernel = new FakeKernel(); compositeKernel.Add(childKernel); CustomCommandTypes.FirstSubmission.MyCommand commandPassedToHandler = null; KernelInvocationContext contextPassedToHandler = null; childKernel.RegisterCommandHandler <CustomCommandTypes.FirstSubmission.MyCommand>( (command, context) => { commandPassedToHandler = command; contextPassedToHandler = context; return(Task.CompletedTask); }); var commandSentToCompositeKernel = new CustomCommandTypes.FirstSubmission.MyCommand("xyzzy"); await compositeKernel.SendAsync(commandSentToCompositeKernel); commandPassedToHandler .Should() .BeSameAs(commandSentToCompositeKernel); contextPassedToHandler .Should() .NotBeNull(); }