-
-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathBunitJSRuntime.cs
More file actions
58 lines (43 loc) · 2.22 KB
/
BunitJSRuntime.cs
File metadata and controls
58 lines (43 loc) · 2.22 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using Bunit.JSInterop.Implementation;
namespace Bunit.JSInterop;
/// <summary>
/// bUnit's implementation of the <see cref="IJSRuntime"/>
/// and <see cref="IJSInProcessRuntime"/> types.
/// </summary>
internal sealed partial class BunitJSRuntime : IJSInProcessRuntime
{
private BunitJSInterop JSInterop { get; }
public BunitJSRuntime(BunitJSInterop jsInterop)
{
JSInterop = jsInterop;
}
/// <inheritdoc/>
public ValueTask<TValue> InvokeAsync<TValue>(string identifier, object?[]? args)
=> JSInterop.HandleInvokeAsync<TValue>(identifier, args);
/// <inheritdoc/>
public ValueTask<TValue> InvokeAsync<TValue>(string identifier, CancellationToken cancellationToken, object?[]? args)
=> JSInterop.HandleInvokeAsync<TValue>(identifier, cancellationToken, args);
#if NET10_0_OR_GREATER
/// <inheritdoc/>
public ValueTask<IJSObjectReference> InvokeNewAsync(string identifier, object?[]? args) => throw new NotImplementedException();
/// <inheritdoc/>
public ValueTask<IJSObjectReference> InvokeNewAsync(string identifier, CancellationToken cancellationToken, object?[]? args) => throw new NotImplementedException();
/// <inheritdoc/>
public ValueTask<TValue> GetValueAsync<TValue>(string identifier) => throw new NotImplementedException();
/// <inheritdoc/>
public ValueTask<TValue> GetValueAsync<TValue>(string identifier, CancellationToken cancellationToken) => throw new NotImplementedException();
/// <inheritdoc/>
public ValueTask SetValueAsync<TValue>(string identifier, TValue value) => throw new NotImplementedException();
/// <inheritdoc/>
public ValueTask SetValueAsync<TValue>(string identifier, TValue value, CancellationToken cancellationToken) => throw new NotImplementedException();
/// <inheritdoc/>
public IJSInProcessObjectReference InvokeNew(string identifier, params object?[]? args) => throw new NotImplementedException();
/// <inheritdoc/>
public TValue GetValue<TValue>(string identifier) => throw new NotImplementedException();
/// <inheritdoc/>
public void SetValue<TValue>(string identifier, TValue value) => throw new NotImplementedException();
#endif
/// <inheritdoc/>
public TResult Invoke<TResult>(string identifier, params object?[]? args)
=> JSInterop.HandleInvoke<TResult>(identifier, args);
}