Co4324ctor_dictionary.runTest C# (CSharp) Method

runTest() public method

public runTest ( ) : bool
return bool
    public virtual bool runTest()
    {
        Console.Error.WriteLine( "Co4324ctor_dictionary  runTest() started." );
        String strLoc="Loc_000oo";
        StringBuilder sblMsg = new StringBuilder( 99 );
        int iCountErrors = 0;
        int iCountTestcases = 0;
        SortedList sl2 = null;
        Hashtable ht = null;
        StringBuilder sbl3 = new StringBuilder( 99 );
        StringBuilder sbl4 = new StringBuilder( 99 );
        StringBuilder sblWork1 = new StringBuilder( 99 );
        String str5 = null;
        String str6 = null;
        String str7 = null;
        int[] in4a = new int[9];
        int nCapacity = 100;
        try
        {
        LABEL_860_GENERAL:
            do
            {
                strLoc="100cc";
                iCountTestcases++;
                ht = new Hashtable();
                Co4324ctor_dictionary k0 = new Co4324ctor_dictionary ("cde");
                Co4324ctor_dictionary k1 = new Co4324ctor_dictionary ("abc");
                Co4324ctor_dictionary k2 = new Co4324ctor_dictionary ("bcd");
                ht.Add (k0, null);
                ht.Add (k1, null);
                ht.Add (k2, null);
                iCountTestcases++;
                sl2 = new SortedList(ht);
                iCountTestcases++;
                if ( sl2 == null )
                {
                    Console.WriteLine( strTest+ "E_101" );
                    Console.WriteLine( strTest+ "SortedList creation failure" );
                    ++iCountErrors;
                    break;
                }
                iCountTestcases++;
                if ( sl2.Count  != 3 )
                {
                    Console.WriteLine( strTest+ "E_202" );
                    Console.WriteLine( strTest+ "New SortedList is not empty" );
                    ++iCountErrors;
                }
                iCountTestcases++;
                if (sl2.IndexOfKey(k0) != 2) 
                {
                    Console.Error.WriteLine(  "POINTTOBREAK: (E_12ys.1) IndexOfKey(k0)==" +
                        sl2.IndexOfKey(k0) );
                    ++iCountErrors;
                }
                iCountTestcases++;
                if (sl2.IndexOfKey(k1) != 0) 
                {
                    Console.Error.WriteLine( "POINTTOBREAK: (E_12ys.2) IndexOfKey(k1)=="
                        + sl2.IndexOfKey(k1) ) ;
                    ++iCountErrors;
                }
                iCountTestcases++;
                if (sl2.IndexOfKey(k2) != 1) 
                {
                    Console.Error.WriteLine( "POINTTOBREAK: (E_12ys.3) IndexOfKey(k2)=="
                        + sl2.IndexOfKey(k2) ) ;
                    ++iCountErrors;
                }
                iCountTestcases++;
                if ( !((Co4324ctor_dictionary)sl2.GetKey(0)).ToString().Equals ("abc"))
                {
                    Console.Error.WriteLine(  "POINTTOBREAK: (E_14dj.1) Equals(k0)=="
                        + ((Co4324ctor_dictionary)sl2.GetKey(0)).ToString().Equals ("abc") ) ;
                    ++iCountErrors;
                }
                iCountTestcases++;
                if ( !((Co4324ctor_dictionary)sl2.GetKey(1)).ToString().Equals ("bcd"))
                {
                    Console.Error.WriteLine( "POINTTOBREAK: (E_14dj.1) Equals(k1)=="
                        + ((Co4324ctor_dictionary)sl2.GetKey(1)).ToString().Equals ("bcd") ) ;
                    ++iCountErrors;
                }
                iCountTestcases++;
                if ( !((Co4324ctor_dictionary)sl2.GetKey(2)).ToString().Equals ("cde"))
                {
                    Console.Error.WriteLine(  "POINTTOBREAK: (E_14dj.1) Equals(k2)=="
                        + ((Co4324ctor_dictionary)sl2.GetKey(2)).ToString().Equals ("cde") ) ;
                    ++iCountErrors;
                }
                iCountTestcases++;
                ht = new Hashtable();
                sl2 = new SortedList(ht);
                if(sl2.Count!=0)
                {
                    ++iCountErrors;
                    Console.WriteLine("Err_3947tsg! wrong value returned");
                }
            } while ( false );
        }
        catch( Exception exc_general )
        {
            ++iCountErrors;
            Console.Error.WriteLine(  "POINTTOBREAK: Error Err_343un! (Co4324ctor_dictionary) exc_general==" + exc_general  );
            Console.Error.WriteLine(  "EXTENDEDINFO: (Err_343un) strLoc==" + strLoc  );
        }
        if ( iCountErrors == 0 )
        {
            Console.Error.WriteLine( "paSs.   SortedList\\Co4324ctor_dictionary.cs   iCountTestcases==" + iCountTestcases );
            return true;
        }
        else
        {
            Console.Error.WriteLine( "FAiL!   SortedList\\Co4324ctor_dictionary.cs   iCountErrors==" + iCountErrors );
            return false;
        }
    }
    public static void Main( String[] args )

Usage Example

    public static void Main(String[] args)
    {
        bool                  bResult = false;
        StringBuilder         sblMsg  = new StringBuilder(99);
        Co4324ctor_dictionary cbA     = new Co4324ctor_dictionary("abc");

        try
        {
            bResult = cbA.runTest();
        }
        catch (Exception exc_main)
        {
            bResult = false;
            Console.Error.WriteLine("POINTTOBREAK:  FAiL!  Error Err_999zzz! (Co4324ctor_dictionary) Uncaught Exception caught in main(), exc_main==" + exc_main);
        }
        if (!bResult)
        {
            Console.Error.WriteLine("Co4324ctor_dictionary.cs   FAiL!");
        }
        if (bResult == true)
        {
            Environment.ExitCode = 0;
        }
        else
        {
            Environment.ExitCode = 1;
        }
    }
All Usage Examples Of Co4324ctor_dictionary::runTest