public void unsubscribe_should_not_remove_other_handlers() { var bus = new CommandBus("local"); long proccessedCmd = 0; var hndl = new AdHocCommandHandler <TestCommands.TestCommand>( cmd => { Interlocked.Increment(ref proccessedCmd); return(true); }); bus.Subscribe(hndl); bus.Subscribe(new AdHocCommandHandler <TestCommands.TestCommand2>( cmd => { Interlocked.Increment(ref proccessedCmd); return(true); })); bus.Fire(new TestCommands.TestCommand(Guid.NewGuid(), null)); bus.Unsubscribe(hndl); Assert.Throws <CommandNotHandledException>( () => bus.Fire(new TestCommands.TestCommand(Guid.NewGuid(), null))); bus.Fire(new TestCommands.TestCommand2(Guid.NewGuid(), null)); Assert.IsOrBecomesTrue( () => Interlocked.Read(ref proccessedCmd) == 2, msg: "Expected command handled twice, got" + proccessedCmd); }