public async Task it_notifies_when_submission_is_incomplete() { var kernel = await CreateKernelAsync(); await kernel.SendAsync(new SubmitCode("var a =", "csharp")); KernelEvents.Should() .NotContain(e => e is ValueProduced); KernelEvents.Last() .Should() .BeOfType <IncompleteCodeSubmissionReceived>(); }
public async Task it_returns_the_result_of_a_null_expression() { var repl = await CreateKernelAsync(); await repl.SendAsync(new SubmitCode("null")); KernelEvents.Last() .Should() .BeOfType <ValueProduced>() .Which .Value .Should() .BeNull(); }
public async Task it_returns_exceptions_thrown_in_user_code() { var repl = await CreateKernelAsync(); await repl.SendAsync(new SubmitCode("throw new System.NotImplementedException();")); KernelEvents.Last() .Should() .BeOfType <CodeSubmissionEvaluationFailed>() .Which .Error .Should() .BeOfType <NotImplementedException>(); }
public async Task it_returns_exceptions_thrown_in_user_code() { var kernel = await CreateKernelAsync(); await kernel.SendAsync(new SubmitCode("using System;", "csharp")); await kernel.SendAsync(new SubmitCode("throw new NotImplementedException();", "csharp")); KernelEvents.Last() .Should() .BeOfType <CodeSubmissionEvaluationFailed>() .Which .Exception .Should() .BeOfType <NotImplementedException>(); }
public async Task it_returns_diagnostics() { var kernel = await CreateKernelAsync(); await kernel.SendAsync(new SubmitCode("using System;", "csharp")); await kernel.SendAsync(new SubmitCode("aaaadd", "csharp")); KernelEvents.Last() .Should() .BeOfType <CodeSubmissionEvaluationFailed>() .Which .Message .Should() .Be("(1,1): error CS0103: The name 'aaaadd' does not exist in the current context"); }
public async Task it_aggregates_multiple_submissions() { var repl = await CreateKernelAsync(); await repl.SendAsync(new SubmitCode("var x = 123;")); await repl.SendAsync(new SubmitCode("x")); KernelEvents.Last() .Should() .BeOfType <ValueProduced>() .Which .Value .Should() .Be(123); }