-
Notifications
You must be signed in to change notification settings - Fork 367
/
HtmlKernelTests.cs
46 lines (39 loc) · 1.31 KB
/
HtmlKernelTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using FluentAssertions;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.DotNet.Interactive.Commands;
using Microsoft.DotNet.Interactive.Events;
using Microsoft.DotNet.Interactive.Tests.Utility;
using Xunit;
namespace Microsoft.DotNet.Interactive.Tests
{
public class HtmlKernelTests
{
[Fact]
public async Task html_emits_string_as_content_within_a_script_element()
{
using var kernel = new CompositeKernel
{
new HtmlKernel()
};
var html = "<b>hello!</b>";
using var events = kernel.KernelEvents.ToSubscribedList();
await kernel.SendAsync(new SubmitCode($"#!html\n\n{html}"));
var formatted =
events
.OfType<DisplayedValueProduced>()
.SelectMany(v => v.FormattedValues)
.ToArray();
formatted
.Should()
.ContainSingle(v => v.MimeType == "text/html")
.Which
.Value
.Trim()
.Should()
.Be(html);
}
}
}