public void ThrowOnError_NTStatus() { NTStatus success = NTStatus.Code.STATUS_SUCCESS; success.ThrowOnError(); NTStatus failure = NTStatus.Code.RPC_NT_CALL_FAILED; Assert.Throws <NTStatusException>(() => failure.ThrowOnError()); try { failure.ThrowOnError(); Assert.False(true, "Expected exception not thrown."); } catch (NTStatusException ex) { #if DESKTOP Assert.Equal("The remote procedure call failed (NT_STATUS error: RPC_NT_CALL_FAILED (0xC002001B))", ex.Message); #else Assert.Equal("NT_STATUS error: RPC_NT_CALL_FAILED (0xC002001B)", ex.Message); #endif } }