public void TestAsyncCallWithObjectsByRef() { int result; object x, y, x2, y2; IAsyncResult ar; ObjectByRefMethod m = new ObjectByRefMethod(ObjectByRefAdd); x = 10; y = 20; x2 = x; y2 = y; ar = m.BeginInvoke(ref x, ref y, null, null); result = (int)m.EndInvoke(ref x, ref y, ar); Assert("x==y2", Object.ReferenceEquals(x, y2)); Assert("y==x2", Object.ReferenceEquals(y, x2)); AssertEquals("result==30", 30, result); }
public void TestAsyncCallWithObjectsByRef() { int result; object x, y, x2, y2; IAsyncResult ar; ObjectByRefMethod m = new ObjectByRefMethod(ObjectByRefAdd); x = 10; y = 20; x2 = x; y2 = y; ar = m.BeginInvoke(ref x, ref y, null, null); result = (int)m.EndInvoke(ref x, ref y, ar); Assert("x==y2", Object.ReferenceEquals(x, y2)); Assert("y==x2", Object.ReferenceEquals(y, x2)); AssertEquals("result==30", 30, result); }