public virtual void TestRPCServiceExceptionUnwrapping() { string message = "ServiceExceptionMessage"; ServiceException se = new ServiceException(message); Exception t = null; try { RPCUtil.UnwrapAndThrowException(se); } catch (Exception thrown) { t = thrown; } NUnit.Framework.Assert.IsTrue(typeof(IOException).IsInstanceOfType(t)); NUnit.Framework.Assert.IsTrue(t.Message.Contains(message)); }
private void VerifyRemoteExceptionUnwrapping(Type expectedLocalException, string realExceptionClassName) { string message = realExceptionClassName + "Message"; RemoteException re = new RemoteException(realExceptionClassName, message); ServiceException se = new ServiceException(re); Exception t = null; try { RPCUtil.UnwrapAndThrowException(se); } catch (Exception thrown) { t = thrown; } NUnit.Framework.Assert.IsTrue("Expected exception [" + expectedLocalException + "] but found " + t, expectedLocalException.IsInstanceOfType(t)); NUnit.Framework.Assert.IsTrue("Expected message [" + message + "] but found " + t .Message, t.Message.Contains(message)); }