public async Task It_produces_commandHandled_only_for_root_command()
        {
            await _standardIOKernelServer.WriteAsync(new SubmitCode("display(1543); display(4567);"));

            _events.Should()
            .ContainSingle(e => e["eventType"].Value <string>() == nameof(CommandHandled));
        }
        public async Task It_produces_a_unique_CommandHandled_for_root_command()
        {
            var command = new SubmitCode("#!time\ndisplay(1543); display(4567);");

            command.SetToken("abc");

            await _standardIOKernelServer.WriteAsync(command);

            _kernelEvents
            .Should()
            .ContainSingle <KernelEventEnvelope <CommandHandled> >()
            .Which
            .Event
            .Command
            .GetToken()
            .Should()
            .Be("abc");
        }
        public static Task WriteAsync(
            this StandardIOKernelServer server,
            KernelCommand command)
        {
            var json = KernelCommandEnvelope.Serialize(
                KernelCommandEnvelope.Create(command));

            return(server.WriteAsync(json));
        }
예제 #4
0
 public static Task WriteAsync(
     this StandardIOKernelServer server,
     IKernelCommand kernelCommand,
     int correlationId = -1)
 {
     return(server.WriteAsync(
                new StreamKernelCommand
     {
         Id = correlationId,
         CommandType = kernelCommand.GetType().Name,
         Command = kernelCommand
     }.Serialize()));
 }