public async Task composite_kernel_can_serialize_notebooks(string fileName) { using var kernel = CreateCompositeKernel(); var notebook = new Documents.InteractiveDocument(new[] { new InteractiveDocumentElement("csharp", "var x = 1;") }); await kernel.SendAsync(new SerializeInteractiveDocument(fileName, notebook, "\n", ".NET")); var expectedLines = new[] { "#!csharp", "", "var x = 1;", "" }; var expectedText = string.Join("\n", expectedLines); KernelEvents .Should() .ContainSingle <InteractiveDocumentSerialized>() .Which .RawData .AsString() // passing throught via this helper to make a test failure easier to identify .Should() .Be(expectedText); }
public SerializeInteractiveDocument(string fileName, Documents.InteractiveDocument document, string newLine, string targetKernelName = null) : base(targetKernelName) { FileName = fileName; Document = document; NewLine = newLine; }
public InteractiveDocumentParsed(Documents.InteractiveDocument document, KernelCommand command) : base(command) { Document = document; }