示例#1
0
        public KernelServerTests(ITestOutputHelper output)
        {
            var kernel = new CompositeKernel
            {
                new CSharpKernel()
                .UseKernelHelpers()
                .UseNugetDirective()
                .UseDefaultFormatting()
                .UseDefaultMagicCommands()
            };


            _kernelServer = kernel.CreateKernelServer(new StreamReader(new MemoryStream()), new StringWriter(), new DirectoryInfo(Environment.CurrentDirectory));

            _kernelEvents = _kernelServer
                            .Output
                            .Where(s => !string.IsNullOrWhiteSpace(s))
                            .Select(KernelEventEnvelope.Deserialize)
                            .ToSubscribedList();

            _disposables.Add(_kernelServer);
            _disposables.Add(output.SubscribeToPocketLogger());
            _disposables.Add(kernel.LogEventsToPocketLogger());
            _disposables.Add(kernel);
        }