コード例 #1
0
    public void CanSanitizeDotNetInteropExceptions()
    {
        // Arrange
        var runtime    = new TestJSRuntime();
        var exception  = new Exception("Some really sensitive data in here");
        var invocation = new DotNetInvocationInfo("TestAssembly", "TestMethod", 0, "0");
        var result     = new DotNetInvocationResult(exception, default);

        // Act
        runtime.EndInvokeDotNet(invocation, result);

        // Assert
        var call = runtime.EndInvokeDotNetCalls.Single();

        Assert.Equal("0", call.CallId);
        Assert.False(call.Success);

        var error = Assert.IsType <JSError>(call.ResultError);

        Assert.Same(exception, error.InnerException);
        Assert.Equal(invocation, error.InvocationInfo);
    }