forked from dotnet/runtime
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSecondRuntimeTest.cs
More file actions
Latest commit
37 lines (31 loc) · 1.27 KB
/
Copy pathSecondRuntimeTest.cs
File metadata and controls
37 lines (31 loc) · 1.27 KB
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
usingSystem.Collections.Generic;
usingSystem.IO;
usingSystem.Runtime.CompilerServices;
usingSystem.Threading.Tasks;
usingXunit;
namespaceSystem.Runtime.InteropServices.JavaScript.Tests
{
publicpartialclassSecondRuntimeTest
{
[ConditionalFact(typeof(PlatformDetection),nameof(PlatformDetection.IsBrowserDomSupportedOrNodeJS))]
publicstaticasyncTaskRunSecondRuntimeAndTestStaticState()
{
awaitJSHost.ImportAsync("SecondRuntimeTest","../SecondRuntimeTest.js");
Interop.State=42;
varstate2=awaitInterop.RunSecondRuntimeAndTestStaticState();
Assert.Equal(44,Interop.State);
Assert.Equal(3,state2);
}
publicstaticpartialclassInterop
{
publicstaticintState{get;set;}
[JSExport]
publicstaticintIncrementState()=>++State;
[JSImport("runSecondRuntimeAndTestStaticState","SecondRuntimeTest")]
[return:JSMarshalAs<JSType.Promise<JSType.Number>>]
internalstaticpartialTask<int>RunSecondRuntimeAndTestStaticState();
}
}
}