public virtual bool runTest()
   {
   Console.Out.WriteLine( "Delegate\\Co3152GetMethod. runTest() started." );
   int iCountErrors = 0;
   int iCountTestcases = 0;
   String strError = null;
   Co3152GetMethod cb1 = new Co3152GetMethod();
   Co3152GetMethod cb2 = new Co3152GetMethod();
   Co3152_dlg_1 dlg1 = null;
   Co3152_dlg_1 dlg2 = null;
   Co3152_dlg_3 dlg3 = null;
   Co3152_dlg_4 dlg4 = null;
   Co3152_dlgmc_1 mcDlg1a = null;
   Co3152_dlgmc_1 mcDlg1b = null;
   dlg3 = new Co3152_dlg_3(Co3152GetMethod.method5);
   iCountTestcases++;
   try {
   if(!"method5".Equals(dlg3.Method.Name ))
     {
     iCountErrors++;
     print("E_47hq");
     }
   iCountTestcases++;
   if(!"Co3152GetMethod".Equals(dlg3.Method.DeclaringType.ToString()))
     {
     iCountErrors++;
     print("E_791n");
     }
   if(!"Int32 method5(Int32)".Equals(dlg3.Method.ToString()))
     {
     iCountErrors++;
     print("E_34hq Expected: Int32 method5 (Int32); Got: " + dlg3.Method.ToString());
     }
   } catch (Exception exc) {
   iCountErrors++;
   print("E_84qw");
   strError = "EXTENEDINFO: "+exc.ToString();
   Console.Error.WriteLine(strError);
   }
   dlg1 = new Co3152_dlg_1(cb1.method1);
   iCountTestcases++;
   if(!"method1".Equals(dlg1.Method.Name ))
     {
     iCountErrors++;
     print("E_239a");
     }
   iCountTestcases++;
   if(!"Co3152GetMethod".Equals(dlg1.Method.DeclaringType.ToString()))
     {
     iCountErrors++;
     print("E_94id");
     }
   iCountTestcases++;
   if("method3".Equals(dlg1.Method.Name ))
     {
     iCountErrors++;
     print("E_39dn");
     }
   iCountTestcases++;
   if(!"Void method1()".Equals(dlg1.Method.ToString()))
     {
     iCountErrors++;
     print("E_741f! got=="+dlg1.Method.ToString());
     }
   Console.WriteLine(dlg1.Method.Name);
   Console.WriteLine(dlg1.Method.ToString());
   dlg3 = new Co3152_dlg_3(cb1.method1);
   iCountTestcases++;
   if(!"method1".Equals(dlg3.Method.Name ))
     {
     iCountErrors++;
     print("E_20ka");
     }
   iCountTestcases++;
   if(!"Co3152GetMethod".Equals(dlg3.Method.DeclaringType.ToString()))
     {
     iCountErrors++;
     print("E_348i");
     }
   dlg3 = new Co3152_dlg_3(cb1.method2);
   iCountTestcases++;
   if(!"method2".Equals(dlg3.Method.Name ))
     {
     iCountErrors++;
     print("E_239a");
     }
   iCountTestcases++;
   if(!"Int32 method2(Int32)".Equals(dlg3.Method.ToString()))
     {
     iCountErrors++;
     print("E_974h");
     }
   dlg4 = new Co3152_dlg_4(cb1.method4);;
   iCountTestcases++;
   if(!"method4".Equals(dlg4.Method.Name ))
     {
     iCountErrors++;
     print("E_u893");
     }
   iCountTestcases++;
   if(!"Co3152GetMethod".Equals(dlg4.Method.DeclaringType.ToString()))
     {
     iCountErrors++;
     print("E_72jd");
     }
   iCountTestcases++;
   if(!"Int32 method4(Int32, Int16)".Equals(dlg4.Method.ToString()))
     {
     iCountErrors++;
     print("E_947hw");
     }
   dlg1 = new Co3152_dlg_1(cb1.method1);
   dlg3 = new Co3152_dlg_3(cb1.method1);
   iCountTestcases++;
   if((dlg1.Method.ToString()).Equals(dlg3.Method.ToString()))
     {
     iCountErrors++;
     print("E_93gb");
     }
   dlg1 = new Co3152_dlg_1(cb1.method1);
   dlg2 = new Co3152_dlg_1(cb1.method1);
   iCountTestcases++;
   if(!(dlg1.Method.ToString()).Equals(dlg2.Method.ToString()))
     {
     iCountErrors++;
     print("E_49xx");
     }
   mcDlg1a = new Co3152_dlgmc_1(cb1.method1);
   mcDlg1b = new Co3152_dlgmc_1(cb1.method3);
   try {
   AddToDelegate(mcDlg1a);
   AddToDelegate(mcDlg1b); 
   } catch (Exception exc)
     {
     iCountErrors++;
     print("E_389a");
     strError = "EXTENEDINFO: "+exc.ToString();
     Console.Error.WriteLine(strError);
     }
   iCountTestcases++;
   if(!"method3".Equals(MCHandler.Method.Name))
     {
     iCountErrors++;
     print("E_23ak");
     Console.WriteLine (MCHandler.Method.Name);
     Console.WriteLine (MCHandler.GetInvocationList().Length);
     }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
Ejemplo n.º 2
0
    public virtual bool runTest()
    {
        Console.Out.WriteLine("Delegate\\Co3152GetMethod. runTest() started.");
        int             iCountErrors    = 0;
        int             iCountTestcases = 0;
        String          strError        = null;
        Co3152GetMethod cb1             = new Co3152GetMethod();
        Co3152GetMethod cb2             = new Co3152GetMethod();
        Co3152_dlg_1    dlg1            = null;
        Co3152_dlg_1    dlg2            = null;
        Co3152_dlg_3    dlg3            = null;
        Co3152_dlg_4    dlg4            = null;
        Co3152_dlgmc_1  mcDlg1a         = null;
        Co3152_dlgmc_1  mcDlg1b         = null;

        dlg3 = new Co3152_dlg_3(Co3152GetMethod.method5);
        iCountTestcases++;
        try {
            if (!"method5".Equals(dlg3.Method.Name))
            {
                iCountErrors++;
                print("E_47hq");
            }
            iCountTestcases++;
            if (!"Co3152GetMethod".Equals(dlg3.Method.DeclaringType.ToString()))
            {
                iCountErrors++;
                print("E_791n");
            }
            if (!"Int32 method5(Int32)".Equals(dlg3.Method.ToString()))
            {
                iCountErrors++;
                print("E_34hq Expected: Int32 method5 (Int32); Got: " + dlg3.Method.ToString());
            }
        } catch (Exception exc) {
            iCountErrors++;
            print("E_84qw");
            strError = "EXTENEDINFO: " + exc.ToString();
            Console.Error.WriteLine(strError);
        }
        dlg1 = new Co3152_dlg_1(cb1.method1);
        iCountTestcases++;
        if (!"method1".Equals(dlg1.Method.Name))
        {
            iCountErrors++;
            print("E_239a");
        }
        iCountTestcases++;
        if (!"Co3152GetMethod".Equals(dlg1.Method.DeclaringType.ToString()))
        {
            iCountErrors++;
            print("E_94id");
        }
        iCountTestcases++;
        if ("method3".Equals(dlg1.Method.Name))
        {
            iCountErrors++;
            print("E_39dn");
        }
        iCountTestcases++;
        if (!"Void method1()".Equals(dlg1.Method.ToString()))
        {
            iCountErrors++;
            print("E_741f! got==" + dlg1.Method.ToString());
        }
        Console.WriteLine(dlg1.Method.Name);
        Console.WriteLine(dlg1.Method.ToString());
        dlg3 = new Co3152_dlg_3(cb1.method1);
        iCountTestcases++;
        if (!"method1".Equals(dlg3.Method.Name))
        {
            iCountErrors++;
            print("E_20ka");
        }
        iCountTestcases++;
        if (!"Co3152GetMethod".Equals(dlg3.Method.DeclaringType.ToString()))
        {
            iCountErrors++;
            print("E_348i");
        }
        dlg3 = new Co3152_dlg_3(cb1.method2);
        iCountTestcases++;
        if (!"method2".Equals(dlg3.Method.Name))
        {
            iCountErrors++;
            print("E_239a");
        }
        iCountTestcases++;
        if (!"Int32 method2(Int32)".Equals(dlg3.Method.ToString()))
        {
            iCountErrors++;
            print("E_974h");
        }
        dlg4 = new Co3152_dlg_4(cb1.method4);;
        iCountTestcases++;
        if (!"method4".Equals(dlg4.Method.Name))
        {
            iCountErrors++;
            print("E_u893");
        }
        iCountTestcases++;
        if (!"Co3152GetMethod".Equals(dlg4.Method.DeclaringType.ToString()))
        {
            iCountErrors++;
            print("E_72jd");
        }
        iCountTestcases++;
        if (!"Int32 method4(Int32, Int16)".Equals(dlg4.Method.ToString()))
        {
            iCountErrors++;
            print("E_947hw");
        }
        dlg1 = new Co3152_dlg_1(cb1.method1);
        dlg3 = new Co3152_dlg_3(cb1.method1);
        iCountTestcases++;
        if ((dlg1.Method.ToString()).Equals(dlg3.Method.ToString()))
        {
            iCountErrors++;
            print("E_93gb");
        }
        dlg1 = new Co3152_dlg_1(cb1.method1);
        dlg2 = new Co3152_dlg_1(cb1.method1);
        iCountTestcases++;
        if (!(dlg1.Method.ToString()).Equals(dlg2.Method.ToString()))
        {
            iCountErrors++;
            print("E_49xx");
        }
        mcDlg1a = new Co3152_dlgmc_1(cb1.method1);
        mcDlg1b = new Co3152_dlgmc_1(cb1.method3);
        try {
            AddToDelegate(mcDlg1a);
            AddToDelegate(mcDlg1b);
        } catch (Exception exc)
        {
            iCountErrors++;
            print("E_389a");
            strError = "EXTENEDINFO: " + exc.ToString();
            Console.Error.WriteLine(strError);
        }
        iCountTestcases++;
        if (!"method3".Equals(MCHandler.Method.Name))
        {
            iCountErrors++;
            print("E_23ak");
            Console.WriteLine(MCHandler.Method.Name);
            Console.WriteLine(MCHandler.GetInvocationList().Length);
        }
        if (iCountErrors == 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }