private void CallWithCreateObjectAsync(TestService serviceToUse) { RetrieveAdderDelegate rad = new RetrieveAdderDelegate(serviceToUse.RetrieveAdder); // async call IAsyncResult ar1 = rad.BeginInvoke(null, null); System.Int32 arg1 = m_random.Next(100); System.Int32 arg2 = m_random.Next(100); // wait for response Adder result1 = rad.EndInvoke(ar1); Assertion.AssertNotNull(result1); AddCallDelegate acd = new AddCallDelegate(result1.Add); // async call IAsyncResult ar2 = acd.BeginInvoke(arg1, arg2, null, null); // wait for response System.Int32 result2 = acd.EndInvoke(ar2); Assertion.AssertEquals((System.Int32)arg1 + arg2, result2); }
private void CallWithCreateObjectAsync(TestService serviceToUse) { RetrieveAdderDelegate rad = new RetrieveAdderDelegate(serviceToUse.RetrieveAdder); // async call IAsyncResult ar1 = rad.BeginInvoke(null, null); System.Int32 arg1 = m_random.Next(100); System.Int32 arg2 = m_random.Next(100); // wait for response Adder result1 = rad.EndInvoke(ar1); Assertion.AssertNotNull(result1); AddCallDelegate acd = new AddCallDelegate(result1.Add); // async call IAsyncResult ar2 = acd.BeginInvoke(arg1, arg2, null, null); // wait for response System.Int32 result2 = acd.EndInvoke(ar2); Assertion.AssertEquals((System.Int32) arg1 + arg2, result2); }