Ejemplo n.º 1
0
        public async Task CharacterEscapeTest()
        {
            var          runtime = new NodeJSRuntime(Array.Empty <string>());
            const string js      = "'\\t'";
            // literal JS:
            // console.log('\t')
            const string serialized = "\"\\t\"";
            const string expected   = "\t";

            var output = (await runtime.InvokeAsyncImpl(js, null)).StandardOutput;

            Assert(output == serialized + "\n");             // newline is standardoutput artifact

            var deserialized = JsonSerializer.Deserialize <string>(serialized, runtime.Options);

            Assert(deserialized == expected);

            // combination of both tests above:
            var result = await runtime.InvokeAsync <string>(js, null).AsTask();

            Assert(result == expected);
        }
Ejemplo n.º 2
0
 public KaTeXTypesSerializationTests()
 {
     jsRuntime = NodeJSRuntime.CreateDefault();
     KaTeX     = IKaTeX.Create(jsRuntime);
 }
Ejemplo n.º 3
0
 public HtmlDomNodeTests()
 {
     jsRuntime = NodeJSRuntime.CreateDefault();
     KaTeX     = IKaTeX.Create(jsRuntime);
 }