示例#1
0
        public FakeRemoteKernel([CallerMemberName] string name = null) : base(name)
        {
            var receiver = new BlockingCommandAndEventReceiver();
            var sender   = new RecordingKernelCommandAndEventSender();

            RegisterForDisposal(KernelEvents.Subscribe(e => { receiver.Write(new CommandOrEvent(e)); }));

            sender.OnSend(async coe =>
            {
                if (coe.Command is { })
                {
                    await Task.Run(() => SendAsync(coe.Command, CancellationToken.None));
                }
            });