public async Task pwsh_kernel_can_read_variables_from_other_kernels( string from, string codeToWrite, string codeToRead) { using var _ = await ConsoleLock.AcquireAsync(); using var kernel = CreateKernel(); await kernel.SubmitCodeAsync($"{from}\n{codeToWrite}"); var results = await kernel.SubmitCodeAsync($"#!pwsh\n{codeToRead}"); results.KernelEvents.ToSubscribedList().Should() .ContainSingle <StandardOutputValueProduced>() .Which .FormattedValues .Should() .ContainSingle(v => v.MimeType == PlainTextFormatter.MimeType) .Which .Value .Trim() .Should() .Be("123:System.Int32"); }
public async Task pwsh_kernel_variables_shared_from_other_kernels_resolve_to_the_correct_runtime_type(string from, string codeToWrite, string codeToRead) { using var _ = await ConsoleLock.AcquireAsync(); using var kernel = CreateKernel(); using var events = kernel.KernelEvents.ToSubscribedList(); await kernel.SubmitCodeAsync($"{from}\n{codeToWrite}"); await kernel.SubmitCodeAsync($"#!pwsh\n{codeToRead}\n$x + 1"); events.Should() .ContainSingle <StandardOutputValueProduced>() .Which .FormattedValues .Should() .ContainSingle(v => v.MimeType == PlainTextFormatter.MimeType) .Which .Value .Trim() .Should() .Be("2"); }