コード例 #1
0
    public async Task CanPassExceptionFromServer()
    {
        const int COR_E_UNAUTHORIZEDACCESS  = unchecked ((int)0x80070005);
        RemoteInvocationException exception = await Assert.ThrowsAnyAsync <RemoteInvocationException>(() => this.clientRpc.InvokeAsync(nameof(Server.MethodThatThrowsUnauthorizedAccessException)));

        Assert.NotNull(exception.RemoteStackTrace);
        Assert.StrictEqual(COR_E_UNAUTHORIZEDACCESS.ToString(CultureInfo.InvariantCulture), exception.RemoteErrorCode);
    }
コード例 #2
0
    public async Task CanPassExceptionFromServer()
    {
#pragma warning disable SA1139 // Use literal suffix notation instead of casting
        const int COR_E_UNAUTHORIZEDACCESS = unchecked ((int)0x80070005);
#pragma warning restore SA1139 // Use literal suffix notation instead of casting
        RemoteInvocationException exception = await Assert.ThrowsAnyAsync <RemoteInvocationException>(() => this.clientRpc.InvokeAsync(nameof(Server.MethodThatThrowsUnauthorizedAccessException)));

        Assert.NotNull(exception.RemoteStackTrace);
        Assert.StrictEqual(COR_E_UNAUTHORIZEDACCESS.ToString(CultureInfo.InvariantCulture), exception.RemoteErrorCode);
    }