这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Microsoft.DotNet.Interactive.Tests/LanguageKernelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,45 @@ public async Task it_remembers_state_between_submissions(Language language)
.Be(5);
}

// Option 1: inline switch
[Theory]
[InlineData(Language.CSharp)]
//[InlineData(Language.FSharp)] Todo: Issue 695 - dotnet-interactive with an F# notebook does not load System.Text.Json #695
public async Task it_can_reference_system_text_json(Language language)
{
var source = language switch
{
Language.FSharp => new[]
{
@"open System.Text.Json;
let jsonException = JsonException()
let location = jsonException.GetType().Assembly.Location
location.EndsWith(""System.Text.Json.dll"")"
},

Language.CSharp => new[]
{
@"using System.Text.Json;
var jsonException = new JsonException();
var location = jsonException.GetType().Assembly.Location;
location.EndsWith(""System.Text.Json.dll"")"
}
};

var kernel = CreateKernel(language);

await SubmitCode(kernel, source);

KernelEvents
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also do this, which will be more informative if the event is missing:

KernelEvents
  .Should()
  .ContainSingle<ReturnValueProduced>()
  .Which
  .Value
  .Should()
  .BeTrue();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it ...

.Should()
.ContainSingle<ReturnValueProduced>()
.Which
.Value
.Should()
.Be(true);
}


[Theory]
[InlineData(Language.FSharp)]
public async Task kernel_base_ignores_command_line_directives(Language language)
Expand Down