Example #1
0
    public void JSInProcessObjectReference_Invoke_CallsUnderlyingJSRuntimeInvoke()
    {
        // Arrange
        var jsRuntime = new TestJSInProcessRuntime();
        var jsObject  = new JSInProcessObjectReference(jsRuntime, 0);

        // Act
        jsObject.Invoke <object>("test", "arg1", "arg2");

        // Assert
        Assert.Equal(1, jsRuntime.InvokeJSInvocationCount);
    }
Example #2
0
    public void JSInProcessObjectReference_Dispose_DisallowsFurtherInteropCalls()
    {
        // Arrange
        var jsRuntime = new TestJSInProcessRuntime();
        var jsObject  = new JSInProcessObjectReference(jsRuntime, 0);

        // Act
        _ = jsObject.DisposeAsync();

        // Assert
        Assert.Throws <ObjectDisposedException>(() => jsObject.Invoke <object>("test", "arg1", "arg2"));
    }
 public static string InvokeDisposedJSObjectReferenceException(JSInProcessObjectReference jsObjectReference)
 {
     try
     {
         jsObjectReference.Invoke <object>("noop");
         return("No exception thrown");
     }
     catch (JSException e)
     {
         return(e.Message);
     }
 }