Ejemplo n.º 1
0
        public async Task Kernel_can_be_interacted_using_kernel_client()
        {
            await _kernelClient.Start();

            var gate = _io.OutputStream
                       .TakeUntilCommandHandled();

            _io.WriteToInput(new SubmitCode(@"var x = 123;"), 0);

            await gate;

            var events = _events
                         .Select(e => e.ToString(Formatting.None));

            var expectedEvents = new List <string> {
                IOStreams.ToStreamKernelEvent(new CommandHandled(new SubmitCode(@"var x = 123;")), 0).Serialize(),
            };

            events.Should()
            .ContainInOrder(expectedEvents);
        }
Ejemplo n.º 2
0
        public async Task Kernel_can_be_interacted_using_kernel_client()
        {
            await _kernelClient.Start();

            _io.WriteToInput(new SubmitCode(@"var x = 123;"), 0);

            var events = _events
                         .Where(e => e["eventType"].Value <string>() == nameof(CommandHandled))
                         .Take(1)
                         .Timeout(20.Seconds())
                         .Select(e => e.ToString(Formatting.None))
                         .ToEnumerable()
                         .ToList();

            var expectedEvents = new List <string> {
                IOStreams.ToStreamKernelEvent(new CommandHandled(new SubmitCode(@"var x = 123;")), 0).Serialize(),
            };

            events.Should()
            .ContainInOrder(expectedEvents);
        }