public void callbkMethod_float_float(IAsyncResult ar) { float result = 0; dlg_float_float dlg = (dlg_float_float)((AsyncResult)ar).AsyncDelegate; dlg.EndInvoke(ref result, ar); if (result != ExecClass.param_float) { throw (new Exception("Err_Yeh_callBk_008a: float parameter has a wrong value")); } if (ExecClass.value_float != ExecClass.const_float) { throw (new Exception("Err_Yeh_callBk_008: float returned has a wrong value")); } }
public Boolean runTest() { int iCountTestcases = 0; int iCountErrors = 0; iCountTestcases++; IAsyncResult void_void_result = null; try { ExecClass eClass = new ExecClass (); dlg_void_void inst_dlg_void_void = new dlg_void_void (eClass.execMethod_void_void); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_void_void); Object state = new Object(); void_void_result = inst_dlg_void_void.BeginInvoke (cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_001, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult String_String_result = null; try { ExecClass eClass = new ExecClass (); dlg_String_String inst_dlg_String_String = new dlg_String_String (eClass.execMethod_String_String); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_String_String); Object state = new Object(); String temp = ExecClass.param_String; String_String_result = inst_dlg_String_String.BeginInvoke (ref temp, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_001, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult Boolean_Boolean_result = null; try { ExecClass eClass = new ExecClass (); dlg_Boolean_Boolean inst_dlg_Boolean_Boolean = new dlg_Boolean_Boolean (eClass.execMethod_Boolean_Boolean); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_Boolean_Boolean); Object state = new Object(); Boolean temp = ExecClass.param_Boolean; Boolean_Boolean_result = inst_dlg_Boolean_Boolean.BeginInvoke (ref temp, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_003, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult SByte_SByte_result = null; try { ExecClass eClass = new ExecClass (); dlg_SByte_SByte inst_dlg_SByte_SByte = new dlg_SByte_SByte (eClass.execMethod_SByte_SByte); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_SByte_SByte); Object state = new Object(); SByte temp = ExecClass.param_SByte; SByte_SByte_result = inst_dlg_SByte_SByte.BeginInvoke (ref temp, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_004, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult Byte_Byte_result = null; try { ExecClass eClass = new ExecClass (); dlg_Byte_Byte inst_dlg_Byte_Byte = new dlg_Byte_Byte (eClass.execMethod_Byte_Byte); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_Byte_Byte); Object state = new Object(); Byte temp = ExecClass.param_Byte; Byte_Byte_result = inst_dlg_Byte_Byte.BeginInvoke (ref temp, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_005, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult char_char_result = null; try { ExecClass eClass = new ExecClass (); dlg_char_char inst_dlg_char_char = new dlg_char_char (execMethod_char_char); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_char_char); Object state = new Object(); char temp = ExecClass.param_char; char_char_result = inst_dlg_char_char.BeginInvoke (ref temp, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_006, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult double_double_result = null; try { ExecClass eClass = new ExecClass (); dlg_double_double inst_dlg_double_double = new dlg_double_double (eClass.execMethod_double_double); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_double_double); Object state = new Object(); double temp = ExecClass.param_double; double_double_result = inst_dlg_double_double.BeginInvoke (ref temp, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_007, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult float_float_result = null; try { ExecClass eClass = new ExecClass (); dlg_float_float inst_dlg_float_float = new dlg_float_float (eClass.execMethod_float_float); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_float_float); Object state = new Object(); float temp = ExecClass.param_float; float_float_result = inst_dlg_float_float.BeginInvoke (ref temp, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_008, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult long_long_result = null; try { ExecClass eClass = new ExecClass (); dlg_long_long inst_dlg_long_long = new dlg_long_long (eClass.execMethod_long_long); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_long_long); Object state = new Object(); long temp = ExecClass.param_long; long_long_result = inst_dlg_long_long.BeginInvoke (ref temp, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_009, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult short_short_result=null; try { ExecClass eClass = new ExecClass (); dlg_short_short inst_dlg_short_short = new dlg_short_short (eClass.execMethod_short_short); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_short_short); Object state = new Object(); short temp = ExecClass.param_short; short_short_result = inst_dlg_short_short.BeginInvoke (ref temp, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_010, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult int_int_result = null; try { ExecClass eClass = new ExecClass (); dlg_int_int inst_dlg_int_int = new dlg_int_int (eClass.execMethod_int_int); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_int_int); Object state = new Object(); int temp = ExecClass.param_int; int_int_result = inst_dlg_int_int.BeginInvoke (ref temp, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_011, Unexpected exception was thrown ex: " + ex.ToString()); } try{ while (!(short_short_result.IsCompleted && void_void_result.IsCompleted && String_String_result.IsCompleted && Boolean_Boolean_result.IsCompleted && SByte_SByte_result.IsCompleted && Byte_Byte_result.IsCompleted && char_char_result.IsCompleted && double_double_result.IsCompleted && float_float_result.IsCompleted && long_long_result.IsCompleted && short_short_result.IsCompleted && int_int_result.IsCompleted)) { ExecClass.resetValues(); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_ddd, Unexpected exception was thrown ex: " + ex.ToString()); } ExecClass.resetValues(); iCountTestcases++; try { ExecClass eClass = new ExecClass (); dlg_all inst_dlg_all = new dlg_all (eClass.execMethod_all); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_all); Object state = new Object(); String st = ExecClass.param_String; Boolean bo = ExecClass.param_Boolean; SByte sb = ExecClass.param_SByte; Byte by = ExecClass.param_Byte; char c = ExecClass.param_char; double d = ExecClass.param_double; float f = ExecClass.param_float; long l = ExecClass.param_long; short sh = ExecClass.param_short; int i = ExecClass.param_int; IAsyncResult all_result = inst_dlg_all.BeginInvoke (ref st, ref bo, ref sb, ref by, ref c, ref d, ref f, ref l, ref sh, ref i, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_012, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_all static_dlg_all = new dlg_all (ExecClass.static_execMethod_all); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_all); Object state = new Object(); String st = ExecClass.param_String; Boolean bo = ExecClass.param_Boolean; SByte sb = ExecClass.param_SByte; Byte by = ExecClass.param_Byte; char c = ExecClass.param_char; double d = ExecClass.param_double; float f = ExecClass.param_float; long l = ExecClass.param_long; short sh = ExecClass.param_short; int i = ExecClass.param_int; IAsyncResult all_result = static_dlg_all.BeginInvoke (ref st, ref bo, ref sb, ref by, ref c, ref d, ref f, ref l, ref sh, ref i, cb, state); } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_013, Unexpected exception was thrown ex: " + ex.ToString()); } ExecClass.resetValues(); iCountTestcases++; try { dlg_void_void static_dlg_void_void = new dlg_void_void (ExecClass.static_execMethod_void_void); CallbkClass cbClass = new CallbkClass(); void_void_result = static_dlg_void_void.BeginInvoke (null, null); void_void_result.AsyncWaitHandle.WaitOne(10000, false); if (void_void_result.IsCompleted) { static_dlg_void_void.EndInvoke(void_void_result); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_014, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_int_int static_dlg_int_int = new dlg_int_int (ExecClass.static_execMethod_int_int); CallbkClass cbClass = new CallbkClass(); int temp = ExecClass.param_int; int_int_result = static_dlg_int_int.BeginInvoke (ref temp, null, null); int_int_result.AsyncWaitHandle.WaitOne(10000, false); int result = ExecClass.const_int; if (int_int_result.IsCompleted) { static_dlg_int_int.EndInvoke(ref result, int_int_result); } if (result!=ExecClass.param_int) { throw (new Exception ("Err_Yeh_run_15: int parameter has a wrong value")); } if (ExecClass.value_int!=ExecClass.const_int) { throw (new Exception ("Err_Yeh_run_15: int returned has a wrong value")); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_015, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_String_String static_dlg_String_String = new dlg_String_String (ExecClass.static_execMethod_String_String); CallbkClass cbClass = new CallbkClass(); String temp = ExecClass.param_String; String_String_result = static_dlg_String_String.BeginInvoke (ref temp, null, null); String_String_result.AsyncWaitHandle.WaitOne(10000, false); String result = ExecClass.const_String; if (String_String_result.IsCompleted) { static_dlg_String_String.EndInvoke(ref result, String_String_result); } if (result!=ExecClass.param_String) { throw (new Exception ("Err_Yeh_run_16: String parameter has a wrong value")); } if (ExecClass.value_String!=ExecClass.const_String) { throw (new Exception ("Err_Yeh_run_16: String returned has a wrong value")); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_016, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_Boolean_Boolean static_dlg_Boolean_Boolean = new dlg_Boolean_Boolean (ExecClass.static_execMethod_Boolean_Boolean); CallbkClass cbClass = new CallbkClass(); Boolean temp = ExecClass.param_Boolean; Boolean_Boolean_result = static_dlg_Boolean_Boolean.BeginInvoke (ref temp, null, null); Boolean_Boolean_result.AsyncWaitHandle.WaitOne(10000, false); Boolean result = ExecClass.const_Boolean; if (Boolean_Boolean_result.IsCompleted) { static_dlg_Boolean_Boolean.EndInvoke(ref result, Boolean_Boolean_result); } if (result!=ExecClass.param_Boolean) { throw (new Exception ("Err_Yeh_run_17: Boolean parameter has a wrong value")); } if (ExecClass.value_Boolean!=ExecClass.const_Boolean) { throw (new Exception ("Err_Yeh_run_17: Boolean returned has a wrong value")); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_017, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_SByte_SByte static_dlg_SByte_SByte = new dlg_SByte_SByte (ExecClass.static_execMethod_SByte_SByte); CallbkClass cbClass = new CallbkClass(); SByte temp = ExecClass.param_SByte; SByte_SByte_result = static_dlg_SByte_SByte.BeginInvoke (ref temp, null, null); SByte_SByte_result.AsyncWaitHandle.WaitOne(10000, false); SByte result = ExecClass.const_SByte; if (SByte_SByte_result.IsCompleted) { static_dlg_SByte_SByte.EndInvoke(ref result, SByte_SByte_result); } if (result!=ExecClass.param_SByte) { throw (new Exception ("Err_Yeh_run_18: SByte parameter has a wrong value")); } if (ExecClass.value_SByte!=ExecClass.const_SByte) { throw (new Exception ("Err_Yeh_run_18: SByte returned has a wrong value")); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_018, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_Byte_Byte static_dlg_Byte_Byte = new dlg_Byte_Byte (ExecClass.static_execMethod_Byte_Byte); CallbkClass cbClass = new CallbkClass(); byte temp = ExecClass.param_Byte; Byte_Byte_result = static_dlg_Byte_Byte.BeginInvoke (ref temp, null, null); Byte_Byte_result.AsyncWaitHandle.WaitOne(10000, false); byte result = ExecClass.const_Byte; if (Byte_Byte_result.IsCompleted) { static_dlg_Byte_Byte.EndInvoke(ref result, Byte_Byte_result); } if (result!=ExecClass.param_Byte) { throw (new Exception ("Err_Yeh_run_19: Byte parameter has a wrong value")); } if (ExecClass.value_Byte!=ExecClass.const_Byte) { throw (new Exception ("Err_Yeh_run_19: Byte returned has a wrong value")); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_019, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_char_char static_dlg_char_char = new dlg_char_char (static_execMethod_char_char); CallbkClass cbClass = new CallbkClass(); char temp = ExecClass.param_char; char_char_result = static_dlg_char_char.BeginInvoke (ref temp, null, null); char_char_result.AsyncWaitHandle.WaitOne(10000, false); char result = ExecClass.const_char; if (char_char_result.IsCompleted) { static_dlg_char_char.EndInvoke(ref result, char_char_result); } if (result!=ExecClass.param_char) { throw (new Exception ("Err_Yeh_run_20: char parameter has a wrong value")); } if (ExecClass.value_char!=ExecClass.const_char) { throw (new Exception ("Err_Yeh_run_20: char returned has a wrong value")); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_020, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_double_double static_dlg_double_double = new dlg_double_double (ExecClass.static_execMethod_double_double); CallbkClass cbClass = new CallbkClass(); double temp = ExecClass.param_double; double_double_result = static_dlg_double_double.BeginInvoke (ref temp, null, null); double_double_result.AsyncWaitHandle.WaitOne(10000, false); double result = ExecClass.const_double; if (double_double_result.IsCompleted) { static_dlg_double_double.EndInvoke(ref result, double_double_result); } if (result!=ExecClass.param_double) { throw (new Exception ("Err_Yeh_run_21: double parameter has a wrong value")); } if (ExecClass.value_double!=ExecClass.const_double) { throw (new Exception ("Err_Yeh_run_21: double returned has a wrong value")); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_021, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_float_float static_dlg_float_float = new dlg_float_float (ExecClass.static_execMethod_float_float); CallbkClass cbClass = new CallbkClass(); float temp = ExecClass.param_float; float_float_result = static_dlg_float_float.BeginInvoke (ref temp, null, null); float_float_result.AsyncWaitHandle.WaitOne(10000, false); float result = ExecClass.const_float; if (float_float_result.IsCompleted) { static_dlg_float_float.EndInvoke(ref result, float_float_result); } if (result!=ExecClass.param_float) { throw (new Exception ("Err_Yeh_run_22: float parameter has a wrong value")); } if (ExecClass.value_float!=ExecClass.const_float) { throw (new Exception ("Err_Yeh_run_22: float returned has a wrong value")); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_022, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_long_long static_dlg_long_long = new dlg_long_long (ExecClass.static_execMethod_long_long); CallbkClass cbClass = new CallbkClass(); long temp = ExecClass.param_long; long_long_result = static_dlg_long_long.BeginInvoke (ref temp, null, null); long_long_result.AsyncWaitHandle.WaitOne(10000, false); long result = ExecClass.const_long; if (long_long_result.IsCompleted) { static_dlg_long_long.EndInvoke(ref result, long_long_result); } if (result!=ExecClass.param_long) { throw (new Exception ("Err_Yeh_run_23: long parameter has a wrong value")); } if (ExecClass.value_long!=ExecClass.const_long) { throw (new Exception ("Err_Yeh_run_23: long returned has a wrong value")); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_023, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_short_short static_dlg_short_short = new dlg_short_short (ExecClass.static_execMethod_short_short); CallbkClass cbClass = new CallbkClass(); short temp = ExecClass.param_short; short_short_result = static_dlg_short_short.BeginInvoke (ref temp, null, null); short_short_result.AsyncWaitHandle.WaitOne(10000, false); short result = ExecClass.const_short; if (short_short_result.IsCompleted) { static_dlg_short_short.EndInvoke(ref result, short_short_result); } if (result!=ExecClass.param_short) { throw (new Exception ("Err_Yeh_run_24: short parameter has a wrong value")); } if (ExecClass.value_short!=ExecClass.const_short) { throw (new Exception ("Err_Yeh_run_24: short returned has a wrong value")); } } catch (Exception ex){ ++iCountErrors; Console.WriteLine("Err_Yeh_024, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { slowmethod sm = new slowmethod(); Del1 del1 = new Del1(sm.goslow); IAsyncResult ar = del1.BeginInvoke(50, null, null); if (ar.IsCompleted) throw new Exception("delegate ran *synchronously*"); Object obj = del1.EndInvoke(ar); if ((int) obj != 50) throw new Exception("EndInvoke returned wrong value"); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_001a, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { slowmethod sm = new slowmethod(); Del1 del1 = new Del1(sm.goslow); IAsyncResult ar = del1.BeginInvoke(50, null, null); Thread.Sleep(100); if (! ar.IsCompleted) throw new Exception("delegate ran synchronously"); Object obj = del1.EndInvoke(ar); if ((int) obj != 50) throw new Exception("EndInvoke returned wrong value"); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_002a, Unexpected exception was thrown ex: " + ex.ToString()); } if ( iCountErrors == 0 ) { return true; } else { return false;} }
public Boolean runTest() { int iCountTestcases = 0; int iCountErrors = 0; iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_int_int_int inst_dlg_int_int_int = new dlg_int_int_int(instCo1901Clone.return_int_add_int_int); inst_dlg_int_int_int = inst_dlg_int_int_int; int numberInvoked = CheckInvkList_int_int_int(inst_dlg_int_int_int); dlg_int_int_int delClone_int_int_int = (dlg_int_int_int)inst_dlg_int_int_int.Clone(); if (numberInvoked != (CheckInvkList_int_int_int(inst_dlg_int_int_int))) { iCountErrors++; Console.WriteLine("Yeh_Err_x001: inst_dlg_int_int_int returned a wrong result"); } int yehInt = delClone_int_int_int(2, -4); if (yehInt != -2) { iCountErrors++; Console.WriteLine("Yeh_Err_001: invokation list changed"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_001, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_void inst_dlg_void = new dlg_void(instCo1901Clone.return_void); dlg_void static_dlg_void = new dlg_void(Co1901Clone.static_return_void); inst_dlg_void = inst_dlg_void; inst_dlg_void = (dlg_void)Delegate.Combine(inst_dlg_void, static_dlg_void); int numberInvoked = CheckInvkList_void(inst_dlg_void); dlg_void dlgClone_void = (dlg_void)inst_dlg_void.Clone(); if (numberInvoked != (CheckInvkList_void(inst_dlg_void))) { iCountErrors++; Console.WriteLine("Yeh_Err_x002: invokation list changed"); } dlgClone_void(); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_002, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_Boolean_Boolean inst_dlg_Boolean_Boolean = new dlg_Boolean_Boolean(instCo1901Clone.return_Boolean_Boolean); dlg_Boolean_Boolean static_dlg_Boolean_Boolean = new dlg_Boolean_Boolean(Co1901Clone.static_return_Boolean_Boolean); inst_dlg_Boolean_Boolean = (dlg_Boolean_Boolean)Delegate.Combine(static_dlg_Boolean_Boolean, inst_dlg_Boolean_Boolean); int numberInvoked = CheckInvkList_Boolean_Boolean(inst_dlg_Boolean_Boolean); dlg_Boolean_Boolean dlgClone_Boolean_Boolean = (dlg_Boolean_Boolean)inst_dlg_Boolean_Boolean.Clone(); if (numberInvoked != (CheckInvkList_Boolean_Boolean(inst_dlg_Boolean_Boolean))) { iCountErrors++; Console.WriteLine("Yeh_Err_x003: invokation list changed"); } Boolean yehBool = dlgClone_Boolean_Boolean(true); if (yehBool != true) { iCountErrors++; Console.WriteLine("Yeh_Err_003: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_003, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_SByte_SByte inst_dlg_SByte_SByte = new dlg_SByte_SByte(instCo1901Clone.return_SByte_SByte); dlg_SByte_SByte static_dlg_SByte_SByte = new dlg_SByte_SByte(Co1901Clone.static_return_SByte_SByte); static_dlg_SByte_SByte = (dlg_SByte_SByte)Delegate.Combine(static_dlg_SByte_SByte, inst_dlg_SByte_SByte); static_dlg_SByte_SByte = static_dlg_SByte_SByte; int numberInvoked = CheckInvkList_SByte_SByte(static_dlg_SByte_SByte); dlg_SByte_SByte dlgClone_SByte_SByte = (dlg_SByte_SByte)static_dlg_SByte_SByte.Clone(); if (numberInvoked != (CheckInvkList_SByte_SByte(static_dlg_SByte_SByte))) { iCountErrors++; Console.WriteLine("Yeh_Err_x004: invokation list changed"); } SByte yehSByte = dlgClone_SByte_SByte(-1); if (yehSByte != -1) { iCountErrors++; Console.WriteLine("Yeh_Err_004: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_004, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_Byte_Byte inst_dlg_Byte_Byte = new dlg_Byte_Byte(instCo1901Clone.return_Byte_Byte); dlg_Byte_Byte static_dlg_Byte_Byte = new dlg_Byte_Byte(Co1901Clone.static_return_Byte_Byte); static_dlg_Byte_Byte = static_dlg_Byte_Byte; static_dlg_Byte_Byte = (dlg_Byte_Byte)Delegate.Combine(inst_dlg_Byte_Byte, static_dlg_Byte_Byte); int numberInvoked = CheckInvkList_Byte_Byte(static_dlg_Byte_Byte); dlg_Byte_Byte dlgClone_Byte_Byte = (dlg_Byte_Byte)static_dlg_Byte_Byte.Clone(); if (numberInvoked != (CheckInvkList_Byte_Byte(static_dlg_Byte_Byte))) { iCountErrors++; Console.WriteLine("Yeh_Err_x005: invokation list changed"); } Byte yehByte = dlgClone_Byte_Byte(0); if (yehByte != 0) { iCountErrors++; Console.WriteLine("Yeh_Err_005: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_005, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_char_char inst_dlg_char_char = new dlg_char_char(instCo1901Clone.return_char_char); dlg_char_char static_dlg_char_char = new dlg_char_char(Co1901Clone.static_return_char_char); inst_dlg_char_char = (dlg_char_char)Delegate.Combine(static_dlg_char_char, inst_dlg_char_char); static_dlg_char_char = (dlg_char_char)Delegate.Combine(inst_dlg_char_char, static_dlg_char_char); inst_dlg_char_char = (dlg_char_char)Delegate.Combine(static_dlg_char_char, inst_dlg_char_char); static_dlg_char_char = (dlg_char_char)Delegate.Combine(inst_dlg_char_char, static_dlg_char_char); inst_dlg_char_char = (dlg_char_char)Delegate.Combine(inst_dlg_char_char, static_dlg_char_char); int numberInvoked = CheckInvkList_char_char(inst_dlg_char_char); dlg_char_char dlgClone_char_char = (dlg_char_char)inst_dlg_char_char.Clone(); if (numberInvoked != (CheckInvkList_char_char(inst_dlg_char_char))) { iCountErrors++; Console.WriteLine("Yeh_Err_x006: invokation list changed"); } numberInvoked = CheckInvkList_char_char(inst_dlg_char_char); dlgClone_char_char = (dlg_char_char)dlgClone_char_char.Clone(); if (numberInvoked != (CheckInvkList_char_char(dlgClone_char_char))) { iCountErrors++; Console.WriteLine("Yeh_Err_x006a: invokation list changed"); } char yehChar = dlgClone_char_char('a'); if (yehChar != 'a') { iCountErrors++; Console.WriteLine("Yeh_Err_006: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_006, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_double_double inst_dlg_double_double = new dlg_double_double(instCo1901Clone.return_double_double); int numberInvoked = CheckInvkList_double_double(inst_dlg_double_double); dlg_double_double dlgClone_double_double = (dlg_double_double)inst_dlg_double_double.Clone(); if (numberInvoked != (CheckInvkList_double_double(inst_dlg_double_double))) { iCountErrors++; Console.WriteLine("Yeh_Err_x007: invokation list changed"); } double yehDouble = dlgClone_double_double(332); if (yehDouble != 332) { iCountErrors++; Console.WriteLine("Yeh_Err_007: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_007, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_double_double static_dlg_double_double = new dlg_double_double(Co1901Clone.static_return_double_double); dlg_double_double dlgClone_double_double = (dlg_double_double)static_dlg_double_double.Clone(); double yehDouble = dlgClone_double_double(332); if (yehDouble != 332) { iCountErrors++; Console.WriteLine("Yeh_Err_007a: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_007a, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_float_float inst_dlg_float_float = new dlg_float_float(instCo1901Clone.return_float_float); dlg_float_float dlgClone_float_float = (dlg_float_float)inst_dlg_float_float.Clone(); float yehFloat = (float)-2.2; yehFloat = dlgClone_float_float(yehFloat); if (yehFloat != (float)-2.2) { iCountErrors++; Console.WriteLine("Yeh_Err_008: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_008, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_float_float static_dlg_float_float = new dlg_float_float(Co1901Clone.static_return_float_float); dlg_float_float dlgClone_float_float = (dlg_float_float)static_dlg_float_float.Clone(); float yehFloat = (float)-2.2; yehFloat = dlgClone_float_float(yehFloat); if (yehFloat != (float)-2.2) { iCountErrors++; Console.WriteLine("Yeh_Err_008a: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_008a, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_long_long inst_dlg_long_long = new dlg_long_long(instCo1901Clone.return_long_long); dlg_long_long dlgClone_long_long = (dlg_long_long)inst_dlg_long_long.Clone(); long yehLong = (long)-2; yehLong = dlgClone_long_long(yehLong); if (yehLong != (long)-2) { iCountErrors++; Console.WriteLine("Yeh_Err_009: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_009, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_long_long static_dlg_long_long = new dlg_long_long(Co1901Clone.static_return_long_long); dlg_long_long dlgClone_long_long = (dlg_long_long)static_dlg_long_long.Clone(); long yehLong = (long)-2; yehLong = dlgClone_long_long(yehLong); if (yehLong != (long)-2) { iCountErrors++; Console.WriteLine("Yeh_Err_009a: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_009a, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_short_short inst_dlg_short_short = new dlg_short_short(instCo1901Clone.return_short_short); dlg_short_short dlgClone_short_short = (dlg_short_short)inst_dlg_short_short.Clone(); short yehShort = (short)-2; yehShort = dlgClone_short_short(yehShort); if (yehShort != (short)-2) { iCountErrors++; Console.WriteLine("Yeh_Err_010: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_010, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_string_string inst_dlg_string_string = new dlg_string_string(instCo1901Clone.return_String_String); dlg_string_string dlgClone_string_string = (dlg_string_string)inst_dlg_string_string.Clone(); String yehString = "anything\\,\\+weird"; yehString = dlgClone_string_string(yehString); if (yehString != "anything\\,\\+weird") { iCountErrors++; Console.WriteLine("Yeh_Err_001: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_011, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { someclass sc = new someclass(); Del del1 = new Del(sc.counter); Del del2 = (Del)del1.Clone(); if (del1() != 1) { throw new Exception("wrong return from del1()"); } if (del2() != 2) { throw new Exception("wrong return from del1()"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_001a, Unexpected exception was thrown ex: " + ex.ToString()); } if (iCountErrors == 0) { return(true); } else { return(false); } }
public Boolean runTest() { int iCountTestcases = 0; int iCountErrors = 0; iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_int_int_int inst_dlg_int_int_int = new dlg_int_int_int (instCo1901Clone.return_int_add_int_int); inst_dlg_int_int_int = inst_dlg_int_int_int; int numberInvoked = CheckInvkList_int_int_int(inst_dlg_int_int_int); dlg_int_int_int delClone_int_int_int = (dlg_int_int_int) inst_dlg_int_int_int.Clone(); if (numberInvoked!=(CheckInvkList_int_int_int(inst_dlg_int_int_int))) { iCountErrors++; Console.WriteLine ("Yeh_Err_x001: inst_dlg_int_int_int returned a wrong result"); } int yehInt = delClone_int_int_int (2, -4); if (yehInt!= -2) { iCountErrors++; Console.WriteLine ("Yeh_Err_001: invokation list changed"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_001, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_void inst_dlg_void = new dlg_void (instCo1901Clone.return_void); dlg_void static_dlg_void = new dlg_void (Co1901Clone.static_return_void); inst_dlg_void = inst_dlg_void; inst_dlg_void = (dlg_void) Delegate.Combine (inst_dlg_void, static_dlg_void); int numberInvoked = CheckInvkList_void (inst_dlg_void); dlg_void dlgClone_void = (dlg_void) inst_dlg_void.Clone(); if (numberInvoked!=(CheckInvkList_void (inst_dlg_void))) { iCountErrors++; Console.WriteLine ("Yeh_Err_x002: invokation list changed"); } dlgClone_void (); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_002, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_Boolean_Boolean inst_dlg_Boolean_Boolean = new dlg_Boolean_Boolean (instCo1901Clone.return_Boolean_Boolean); dlg_Boolean_Boolean static_dlg_Boolean_Boolean = new dlg_Boolean_Boolean (Co1901Clone.static_return_Boolean_Boolean); inst_dlg_Boolean_Boolean = (dlg_Boolean_Boolean) Delegate.Combine (static_dlg_Boolean_Boolean, inst_dlg_Boolean_Boolean); int numberInvoked = CheckInvkList_Boolean_Boolean (inst_dlg_Boolean_Boolean); dlg_Boolean_Boolean dlgClone_Boolean_Boolean = (dlg_Boolean_Boolean) inst_dlg_Boolean_Boolean.Clone(); if (numberInvoked != (CheckInvkList_Boolean_Boolean (inst_dlg_Boolean_Boolean))) { iCountErrors++; Console.WriteLine ("Yeh_Err_x003: invokation list changed"); } Boolean yehBool = dlgClone_Boolean_Boolean (true); if (yehBool!= true) { iCountErrors++; Console.WriteLine ("Yeh_Err_003: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_003, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_SByte_SByte inst_dlg_SByte_SByte = new dlg_SByte_SByte (instCo1901Clone.return_SByte_SByte); dlg_SByte_SByte static_dlg_SByte_SByte = new dlg_SByte_SByte (Co1901Clone.static_return_SByte_SByte); static_dlg_SByte_SByte = (dlg_SByte_SByte) Delegate.Combine (static_dlg_SByte_SByte, inst_dlg_SByte_SByte); static_dlg_SByte_SByte = static_dlg_SByte_SByte; int numberInvoked = CheckInvkList_SByte_SByte (static_dlg_SByte_SByte); dlg_SByte_SByte dlgClone_SByte_SByte = (dlg_SByte_SByte) static_dlg_SByte_SByte.Clone(); if (numberInvoked != (CheckInvkList_SByte_SByte (static_dlg_SByte_SByte))) { iCountErrors++; Console.WriteLine ("Yeh_Err_x004: invokation list changed"); } SByte yehSByte = dlgClone_SByte_SByte (-1); if (yehSByte!= -1) { iCountErrors++; Console.WriteLine ("Yeh_Err_004: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_004, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_Byte_Byte inst_dlg_Byte_Byte = new dlg_Byte_Byte (instCo1901Clone.return_Byte_Byte); dlg_Byte_Byte static_dlg_Byte_Byte = new dlg_Byte_Byte (Co1901Clone.static_return_Byte_Byte); static_dlg_Byte_Byte = static_dlg_Byte_Byte; static_dlg_Byte_Byte = (dlg_Byte_Byte) Delegate.Combine (inst_dlg_Byte_Byte, static_dlg_Byte_Byte); int numberInvoked = CheckInvkList_Byte_Byte (static_dlg_Byte_Byte); dlg_Byte_Byte dlgClone_Byte_Byte = (dlg_Byte_Byte) static_dlg_Byte_Byte.Clone(); if (numberInvoked != (CheckInvkList_Byte_Byte (static_dlg_Byte_Byte))) { iCountErrors++; Console.WriteLine ("Yeh_Err_x005: invokation list changed"); } Byte yehByte = dlgClone_Byte_Byte (0); if (yehByte!= 0) { iCountErrors++; Console.WriteLine ("Yeh_Err_005: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_005, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_char_char inst_dlg_char_char = new dlg_char_char (instCo1901Clone.return_char_char); dlg_char_char static_dlg_char_char = new dlg_char_char (Co1901Clone.static_return_char_char); inst_dlg_char_char = (dlg_char_char) Delegate.Combine (static_dlg_char_char, inst_dlg_char_char); static_dlg_char_char = (dlg_char_char) Delegate.Combine (inst_dlg_char_char, static_dlg_char_char); inst_dlg_char_char = (dlg_char_char) Delegate.Combine (static_dlg_char_char, inst_dlg_char_char); static_dlg_char_char = (dlg_char_char) Delegate.Combine (inst_dlg_char_char, static_dlg_char_char); inst_dlg_char_char = (dlg_char_char) Delegate.Combine (inst_dlg_char_char, static_dlg_char_char); int numberInvoked = CheckInvkList_char_char (inst_dlg_char_char); dlg_char_char dlgClone_char_char = (dlg_char_char) inst_dlg_char_char.Clone(); if (numberInvoked != (CheckInvkList_char_char (inst_dlg_char_char))) { iCountErrors++; Console.WriteLine ("Yeh_Err_x006: invokation list changed"); } numberInvoked = CheckInvkList_char_char (inst_dlg_char_char); dlgClone_char_char = (dlg_char_char) dlgClone_char_char.Clone(); if (numberInvoked != (CheckInvkList_char_char (dlgClone_char_char))) { iCountErrors++; Console.WriteLine ("Yeh_Err_x006a: invokation list changed"); } char yehChar = dlgClone_char_char ('a'); if (yehChar!= 'a') { iCountErrors++; Console.WriteLine ("Yeh_Err_006: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_006, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_double_double inst_dlg_double_double = new dlg_double_double (instCo1901Clone.return_double_double); int numberInvoked = CheckInvkList_double_double (inst_dlg_double_double); dlg_double_double dlgClone_double_double = (dlg_double_double) inst_dlg_double_double.Clone(); if (numberInvoked != (CheckInvkList_double_double (inst_dlg_double_double))) { iCountErrors++; Console.WriteLine ("Yeh_Err_x007: invokation list changed"); } double yehDouble = dlgClone_double_double (332); if (yehDouble!= 332) { iCountErrors++; Console.WriteLine ("Yeh_Err_007: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_007, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_double_double static_dlg_double_double = new dlg_double_double (Co1901Clone.static_return_double_double); dlg_double_double dlgClone_double_double = (dlg_double_double) static_dlg_double_double.Clone(); double yehDouble = dlgClone_double_double (332); if (yehDouble!= 332) { iCountErrors++; Console.WriteLine ("Yeh_Err_007a: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_007a, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_float_float inst_dlg_float_float = new dlg_float_float (instCo1901Clone.return_float_float); dlg_float_float dlgClone_float_float = (dlg_float_float) inst_dlg_float_float.Clone(); float yehFloat = (float)-2.2; yehFloat = dlgClone_float_float (yehFloat); if (yehFloat!= (float)-2.2) { iCountErrors++; Console.WriteLine ("Yeh_Err_008: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_008, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_float_float static_dlg_float_float = new dlg_float_float (Co1901Clone.static_return_float_float); dlg_float_float dlgClone_float_float = (dlg_float_float) static_dlg_float_float.Clone(); float yehFloat = (float)-2.2; yehFloat = dlgClone_float_float (yehFloat); if (yehFloat!= (float)-2.2) { iCountErrors++; Console.WriteLine ("Yeh_Err_008a: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_008a, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_long_long inst_dlg_long_long = new dlg_long_long (instCo1901Clone.return_long_long); dlg_long_long dlgClone_long_long = (dlg_long_long) inst_dlg_long_long.Clone(); long yehLong = (long)-2; yehLong = dlgClone_long_long (yehLong); if (yehLong!= (long)-2) { iCountErrors++; Console.WriteLine ("Yeh_Err_009: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_009, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_long_long static_dlg_long_long = new dlg_long_long (Co1901Clone.static_return_long_long); dlg_long_long dlgClone_long_long = (dlg_long_long) static_dlg_long_long.Clone(); long yehLong = (long)-2; yehLong = dlgClone_long_long (yehLong); if (yehLong!= (long)-2) { iCountErrors++; Console.WriteLine ("Yeh_Err_009a: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_009a, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_short_short inst_dlg_short_short = new dlg_short_short (instCo1901Clone.return_short_short); dlg_short_short dlgClone_short_short = (dlg_short_short) inst_dlg_short_short.Clone(); short yehShort = (short)-2; yehShort = dlgClone_short_short (yehShort); if (yehShort!= (short)-2) { iCountErrors++; Console.WriteLine ("Yeh_Err_010: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_010, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { Co1901Clone instCo1901Clone = new Co1901Clone(); dlg_string_string inst_dlg_string_string = new dlg_string_string (instCo1901Clone.return_String_String); dlg_string_string dlgClone_string_string = (dlg_string_string) inst_dlg_string_string.Clone(); String yehString = "anything\\,\\+weird"; yehString = dlgClone_string_string (yehString); if (yehString!= "anything\\,\\+weird") { iCountErrors++; Console.WriteLine ("Yeh_Err_001: inst_dlg_int_int_int returned a wrong result"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Yeh_Ex_011, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { someclass sc = new someclass(); Del del1 = new Del(sc.counter); Del del2 = (Del) del1.Clone(); if (del1() != 1) throw new Exception("wrong return from del1()"); if (del2() != 2) throw new Exception("wrong return from del1()"); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_001a, Unexpected exception was thrown ex: " + ex.ToString()); } if ( iCountErrors == 0 ) { return true; } else { return false;} }
public Boolean runTest() { int iCountTestcases = 0; int iCountErrors = 0; iCountTestcases++; IAsyncResult void_void_result = null; try { ExecClass eClass = new ExecClass(); dlg_void_void inst_dlg_void_void = new dlg_void_void(eClass.execMethod_void_void); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_void_void); Object state = new Object(); void_void_result = inst_dlg_void_void.BeginInvoke(cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_001, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult String_String_result = null; try { ExecClass eClass = new ExecClass(); dlg_String_String inst_dlg_String_String = new dlg_String_String(eClass.execMethod_String_String); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_String_String); Object state = new Object(); String temp = ExecClass.param_String; String_String_result = inst_dlg_String_String.BeginInvoke(ref temp, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_001, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult Boolean_Boolean_result = null; try { ExecClass eClass = new ExecClass(); dlg_Boolean_Boolean inst_dlg_Boolean_Boolean = new dlg_Boolean_Boolean(eClass.execMethod_Boolean_Boolean); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_Boolean_Boolean); Object state = new Object(); Boolean temp = ExecClass.param_Boolean; Boolean_Boolean_result = inst_dlg_Boolean_Boolean.BeginInvoke(ref temp, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_003, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult SByte_SByte_result = null; try { ExecClass eClass = new ExecClass(); dlg_SByte_SByte inst_dlg_SByte_SByte = new dlg_SByte_SByte(eClass.execMethod_SByte_SByte); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_SByte_SByte); Object state = new Object(); SByte temp = ExecClass.param_SByte; SByte_SByte_result = inst_dlg_SByte_SByte.BeginInvoke(ref temp, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_004, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult Byte_Byte_result = null; try { ExecClass eClass = new ExecClass(); dlg_Byte_Byte inst_dlg_Byte_Byte = new dlg_Byte_Byte(eClass.execMethod_Byte_Byte); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_Byte_Byte); Object state = new Object(); Byte temp = ExecClass.param_Byte; Byte_Byte_result = inst_dlg_Byte_Byte.BeginInvoke(ref temp, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_005, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult char_char_result = null; try { ExecClass eClass = new ExecClass(); dlg_char_char inst_dlg_char_char = new dlg_char_char(execMethod_char_char); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_char_char); Object state = new Object(); char temp = ExecClass.param_char; char_char_result = inst_dlg_char_char.BeginInvoke(ref temp, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_006, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult double_double_result = null; try { ExecClass eClass = new ExecClass(); dlg_double_double inst_dlg_double_double = new dlg_double_double(eClass.execMethod_double_double); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_double_double); Object state = new Object(); double temp = ExecClass.param_double; double_double_result = inst_dlg_double_double.BeginInvoke(ref temp, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_007, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult float_float_result = null; try { ExecClass eClass = new ExecClass(); dlg_float_float inst_dlg_float_float = new dlg_float_float(eClass.execMethod_float_float); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_float_float); Object state = new Object(); float temp = ExecClass.param_float; float_float_result = inst_dlg_float_float.BeginInvoke(ref temp, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_008, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult long_long_result = null; try { ExecClass eClass = new ExecClass(); dlg_long_long inst_dlg_long_long = new dlg_long_long(eClass.execMethod_long_long); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_long_long); Object state = new Object(); long temp = ExecClass.param_long; long_long_result = inst_dlg_long_long.BeginInvoke(ref temp, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_009, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult short_short_result = null; try { ExecClass eClass = new ExecClass(); dlg_short_short inst_dlg_short_short = new dlg_short_short(eClass.execMethod_short_short); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_short_short); Object state = new Object(); short temp = ExecClass.param_short; short_short_result = inst_dlg_short_short.BeginInvoke(ref temp, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_010, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; IAsyncResult int_int_result = null; try { ExecClass eClass = new ExecClass(); dlg_int_int inst_dlg_int_int = new dlg_int_int(eClass.execMethod_int_int); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_int_int); Object state = new Object(); int temp = ExecClass.param_int; int_int_result = inst_dlg_int_int.BeginInvoke(ref temp, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_011, Unexpected exception was thrown ex: " + ex.ToString()); } try{ while (!(short_short_result.IsCompleted && void_void_result.IsCompleted && String_String_result.IsCompleted && Boolean_Boolean_result.IsCompleted && SByte_SByte_result.IsCompleted && Byte_Byte_result.IsCompleted && char_char_result.IsCompleted && double_double_result.IsCompleted && float_float_result.IsCompleted && long_long_result.IsCompleted && short_short_result.IsCompleted && int_int_result.IsCompleted)) { ExecClass.resetValues(); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_ddd, Unexpected exception was thrown ex: " + ex.ToString()); } ExecClass.resetValues(); iCountTestcases++; try { ExecClass eClass = new ExecClass(); dlg_all inst_dlg_all = new dlg_all(eClass.execMethod_all); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_all); Object state = new Object(); String st = ExecClass.param_String; Boolean bo = ExecClass.param_Boolean; SByte sb = ExecClass.param_SByte; Byte by = ExecClass.param_Byte; char c = ExecClass.param_char; double d = ExecClass.param_double; float f = ExecClass.param_float; long l = ExecClass.param_long; short sh = ExecClass.param_short; int i = ExecClass.param_int; IAsyncResult all_result = inst_dlg_all.BeginInvoke(ref st, ref bo, ref sb, ref by, ref c, ref d, ref f, ref l, ref sh, ref i, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_012, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_all static_dlg_all = new dlg_all(ExecClass.static_execMethod_all); CallbkClass cbClass = new CallbkClass(); AsyncCallback cb = new AsyncCallback(cbClass.callbkMethod_all); Object state = new Object(); String st = ExecClass.param_String; Boolean bo = ExecClass.param_Boolean; SByte sb = ExecClass.param_SByte; Byte by = ExecClass.param_Byte; char c = ExecClass.param_char; double d = ExecClass.param_double; float f = ExecClass.param_float; long l = ExecClass.param_long; short sh = ExecClass.param_short; int i = ExecClass.param_int; IAsyncResult all_result = static_dlg_all.BeginInvoke(ref st, ref bo, ref sb, ref by, ref c, ref d, ref f, ref l, ref sh, ref i, cb, state); } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_013, Unexpected exception was thrown ex: " + ex.ToString()); } ExecClass.resetValues(); iCountTestcases++; try { dlg_void_void static_dlg_void_void = new dlg_void_void(ExecClass.static_execMethod_void_void); CallbkClass cbClass = new CallbkClass(); void_void_result = static_dlg_void_void.BeginInvoke(null, null); void_void_result.AsyncWaitHandle.WaitOne(10000, false); if (void_void_result.IsCompleted) { static_dlg_void_void.EndInvoke(void_void_result); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_014, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_int_int static_dlg_int_int = new dlg_int_int(ExecClass.static_execMethod_int_int); CallbkClass cbClass = new CallbkClass(); int temp = ExecClass.param_int; int_int_result = static_dlg_int_int.BeginInvoke(ref temp, null, null); int_int_result.AsyncWaitHandle.WaitOne(10000, false); int result = ExecClass.const_int; if (int_int_result.IsCompleted) { static_dlg_int_int.EndInvoke(ref result, int_int_result); } if (result != ExecClass.param_int) { throw (new Exception("Err_Yeh_run_15: int parameter has a wrong value")); } if (ExecClass.value_int != ExecClass.const_int) { throw (new Exception("Err_Yeh_run_15: int returned has a wrong value")); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_015, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_String_String static_dlg_String_String = new dlg_String_String(ExecClass.static_execMethod_String_String); CallbkClass cbClass = new CallbkClass(); String temp = ExecClass.param_String; String_String_result = static_dlg_String_String.BeginInvoke(ref temp, null, null); String_String_result.AsyncWaitHandle.WaitOne(10000, false); String result = ExecClass.const_String; if (String_String_result.IsCompleted) { static_dlg_String_String.EndInvoke(ref result, String_String_result); } if (result != ExecClass.param_String) { throw (new Exception("Err_Yeh_run_16: String parameter has a wrong value")); } if (ExecClass.value_String != ExecClass.const_String) { throw (new Exception("Err_Yeh_run_16: String returned has a wrong value")); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_016, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_Boolean_Boolean static_dlg_Boolean_Boolean = new dlg_Boolean_Boolean(ExecClass.static_execMethod_Boolean_Boolean); CallbkClass cbClass = new CallbkClass(); Boolean temp = ExecClass.param_Boolean; Boolean_Boolean_result = static_dlg_Boolean_Boolean.BeginInvoke(ref temp, null, null); Boolean_Boolean_result.AsyncWaitHandle.WaitOne(10000, false); Boolean result = ExecClass.const_Boolean; if (Boolean_Boolean_result.IsCompleted) { static_dlg_Boolean_Boolean.EndInvoke(ref result, Boolean_Boolean_result); } if (result != ExecClass.param_Boolean) { throw (new Exception("Err_Yeh_run_17: Boolean parameter has a wrong value")); } if (ExecClass.value_Boolean != ExecClass.const_Boolean) { throw (new Exception("Err_Yeh_run_17: Boolean returned has a wrong value")); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_017, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_SByte_SByte static_dlg_SByte_SByte = new dlg_SByte_SByte(ExecClass.static_execMethod_SByte_SByte); CallbkClass cbClass = new CallbkClass(); SByte temp = ExecClass.param_SByte; SByte_SByte_result = static_dlg_SByte_SByte.BeginInvoke(ref temp, null, null); SByte_SByte_result.AsyncWaitHandle.WaitOne(10000, false); SByte result = ExecClass.const_SByte; if (SByte_SByte_result.IsCompleted) { static_dlg_SByte_SByte.EndInvoke(ref result, SByte_SByte_result); } if (result != ExecClass.param_SByte) { throw (new Exception("Err_Yeh_run_18: SByte parameter has a wrong value")); } if (ExecClass.value_SByte != ExecClass.const_SByte) { throw (new Exception("Err_Yeh_run_18: SByte returned has a wrong value")); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_018, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_Byte_Byte static_dlg_Byte_Byte = new dlg_Byte_Byte(ExecClass.static_execMethod_Byte_Byte); CallbkClass cbClass = new CallbkClass(); byte temp = ExecClass.param_Byte; Byte_Byte_result = static_dlg_Byte_Byte.BeginInvoke(ref temp, null, null); Byte_Byte_result.AsyncWaitHandle.WaitOne(10000, false); byte result = ExecClass.const_Byte; if (Byte_Byte_result.IsCompleted) { static_dlg_Byte_Byte.EndInvoke(ref result, Byte_Byte_result); } if (result != ExecClass.param_Byte) { throw (new Exception("Err_Yeh_run_19: Byte parameter has a wrong value")); } if (ExecClass.value_Byte != ExecClass.const_Byte) { throw (new Exception("Err_Yeh_run_19: Byte returned has a wrong value")); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_019, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_char_char static_dlg_char_char = new dlg_char_char(static_execMethod_char_char); CallbkClass cbClass = new CallbkClass(); char temp = ExecClass.param_char; char_char_result = static_dlg_char_char.BeginInvoke(ref temp, null, null); char_char_result.AsyncWaitHandle.WaitOne(10000, false); char result = ExecClass.const_char; if (char_char_result.IsCompleted) { static_dlg_char_char.EndInvoke(ref result, char_char_result); } if (result != ExecClass.param_char) { throw (new Exception("Err_Yeh_run_20: char parameter has a wrong value")); } if (ExecClass.value_char != ExecClass.const_char) { throw (new Exception("Err_Yeh_run_20: char returned has a wrong value")); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_020, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_double_double static_dlg_double_double = new dlg_double_double(ExecClass.static_execMethod_double_double); CallbkClass cbClass = new CallbkClass(); double temp = ExecClass.param_double; double_double_result = static_dlg_double_double.BeginInvoke(ref temp, null, null); double_double_result.AsyncWaitHandle.WaitOne(10000, false); double result = ExecClass.const_double; if (double_double_result.IsCompleted) { static_dlg_double_double.EndInvoke(ref result, double_double_result); } if (result != ExecClass.param_double) { throw (new Exception("Err_Yeh_run_21: double parameter has a wrong value")); } if (ExecClass.value_double != ExecClass.const_double) { throw (new Exception("Err_Yeh_run_21: double returned has a wrong value")); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_021, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_float_float static_dlg_float_float = new dlg_float_float(ExecClass.static_execMethod_float_float); CallbkClass cbClass = new CallbkClass(); float temp = ExecClass.param_float; float_float_result = static_dlg_float_float.BeginInvoke(ref temp, null, null); float_float_result.AsyncWaitHandle.WaitOne(10000, false); float result = ExecClass.const_float; if (float_float_result.IsCompleted) { static_dlg_float_float.EndInvoke(ref result, float_float_result); } if (result != ExecClass.param_float) { throw (new Exception("Err_Yeh_run_22: float parameter has a wrong value")); } if (ExecClass.value_float != ExecClass.const_float) { throw (new Exception("Err_Yeh_run_22: float returned has a wrong value")); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_022, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_long_long static_dlg_long_long = new dlg_long_long(ExecClass.static_execMethod_long_long); CallbkClass cbClass = new CallbkClass(); long temp = ExecClass.param_long; long_long_result = static_dlg_long_long.BeginInvoke(ref temp, null, null); long_long_result.AsyncWaitHandle.WaitOne(10000, false); long result = ExecClass.const_long; if (long_long_result.IsCompleted) { static_dlg_long_long.EndInvoke(ref result, long_long_result); } if (result != ExecClass.param_long) { throw (new Exception("Err_Yeh_run_23: long parameter has a wrong value")); } if (ExecClass.value_long != ExecClass.const_long) { throw (new Exception("Err_Yeh_run_23: long returned has a wrong value")); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_023, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { dlg_short_short static_dlg_short_short = new dlg_short_short(ExecClass.static_execMethod_short_short); CallbkClass cbClass = new CallbkClass(); short temp = ExecClass.param_short; short_short_result = static_dlg_short_short.BeginInvoke(ref temp, null, null); short_short_result.AsyncWaitHandle.WaitOne(10000, false); short result = ExecClass.const_short; if (short_short_result.IsCompleted) { static_dlg_short_short.EndInvoke(ref result, short_short_result); } if (result != ExecClass.param_short) { throw (new Exception("Err_Yeh_run_24: short parameter has a wrong value")); } if (ExecClass.value_short != ExecClass.const_short) { throw (new Exception("Err_Yeh_run_24: short returned has a wrong value")); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_Yeh_024, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { slowmethod sm = new slowmethod(); Del1 del1 = new Del1(sm.goslow); IAsyncResult ar = del1.BeginInvoke(50, null, null); if (ar.IsCompleted) { throw new Exception("delegate ran *synchronously*"); } Object obj = del1.EndInvoke(ar); if ((int)obj != 50) { throw new Exception("EndInvoke returned wrong value"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_001a, Unexpected exception was thrown ex: " + ex.ToString()); } iCountTestcases++; try { slowmethod sm = new slowmethod(); Del1 del1 = new Del1(sm.goslow); IAsyncResult ar = del1.BeginInvoke(50, null, null); Thread.Sleep(100); if (!ar.IsCompleted) { throw new Exception("delegate ran synchronously"); } Object obj = del1.EndInvoke(ar); if ((int)obj != 50) { throw new Exception("EndInvoke returned wrong value"); } } catch (Exception ex) { ++iCountErrors; Console.WriteLine("Err_002a, Unexpected exception was thrown ex: " + ex.ToString()); } if (iCountErrors == 0) { return(true); } else { return(false); } }