コード例 #1
0
        public FormatterConfigurationTests()
        {
            var frontendEnvironment = new HtmlNotebookFrontedEnvironment(new Uri("http://12.12.12.12:4242"));


            CommandLineParser.SetUpFormatters(frontendEnvironment, new StartupOptions(), 1.Seconds());

            _disposables.Add(Formatter.ResetToDefault);
            _disposables.Add(new AssertionScope());
        }
コード例 #2
0
        public void js_wrapping_formatter_fails_if_apiUri_is_not_configured_within_the_configured_timeout()
        {
            var frontendEnvironment = new HtmlNotebookFrontedEnvironment();

            CommandLineParser.SetUpFormatters(frontendEnvironment, new StartupOptions(httpPort: new HttpPort(4242)), 1.Seconds());
            var script   = new ScriptContent("alert('hello');");
            var mimeType = Formatter.GetPreferredMimeTypeFor(script.GetType());

            Action formatting = () => script.ToDisplayString(mimeType);

            formatting.Should()
            .Throw <TimeoutException>()
            .Which
            .Message
            .Should().Be("Timeout resolving the kernel's HTTP endpoint. Please try again.");
        }
コード例 #3
0
        public void ScriptContent_type_is_wrapped_when_http_and_the_frontendEnvironment_is_JupyterFrontedEnvironment()
        {
            var frontendEnvironment = new HtmlNotebookFrontedEnvironment(new Uri("http://12.12.12.12:4242"));

            CommandLineParser.SetUpFormatters(frontendEnvironment, new StartupOptions(httpPort: new HttpPort(4242)), 10.Seconds());
            var script   = new ScriptContent("alert('hello');");
            var mimeType = Formatter.GetPreferredMimeTypeFor(script.GetType());

            var formattedValue = new FormattedValue(
                mimeType,
                script.ToDisplayString(mimeType));

            formattedValue.MimeType.Should().Be("text/html");
            formattedValue.Value.Should().Be(@"<script type=""text/javascript"">if (typeof window.createDotnetInteractiveClient === typeof Function) {
createDotnetInteractiveClient('http://12.12.12.12:4242/').then(function (interactive) {
let notebookScope = getDotnetInteractiveScope('http://12.12.12.12:4242/');
alert('hello');
});
}</script>");
        }
コード例 #4
0
 public HttpApiTunnelingRouter(HtmlNotebookFrontedEnvironment frontendEnvironment)
 {
     _frontendEnvironment = frontendEnvironment;
 }
コード例 #5
0
 public DiscoveryRouter(HtmlNotebookFrontedEnvironment frontendEnvironment)
 {
     _frontendEnvironment = frontendEnvironment;
 }