Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public SerializeInteractiveDocument(string fileName, Documents.InteractiveDocument document, string newLine, string targetKernelName = null)
     : base(targetKernelName)
 {
     FileName = fileName;
     Document = document;
     NewLine  = newLine;
 }
Esempio n. 3
0
 public InteractiveDocumentParsed(Documents.InteractiveDocument document, KernelCommand command)
     : base(command)
 {
     Document = document;
 }