Co5593get_BaseStream.runTest C# (CSharp) Method

runTest() public method

public runTest ( ) : bool
return bool
    public bool runTest()
    {
        Console.WriteLine(s_strTFPath + "\\" + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
        int iCountTestcases = 0;
        String strLoc = "Loc_000oo";
        String strValue = String.Empty;
        try 
        {
            StreamWriter sw2;
            strLoc = "Loc_98yv7";
            MemoryStream memstr2 = new MemoryStream();
            sw2 = new StreamWriter(memstr2);
            iCountTestcases++;
            if(sw2.BaseStream != memstr2) 
            {
                iCountErrors++;
                printerr( "Error_98b8b! Underlying memorystream not the same as original");
            }
            strLoc = "Loc_09uf9";
            FileStream fs = new FileStream(s_strTFAbbrev, FileMode.Create);
            sw2 = new StreamWriter(fs);
            iCountTestcases++;
            if(sw2.BaseStream != fs) 
            {
                iCountErrors++;
                printerr( "Error_3988v! Underlying filestream incorrect");
            } 
            fs.Close();
            File.Delete(s_strTFAbbrev);
            iCountTestcases++;
            m_PortSetEvent.Reset();
            Thread tcpListenerThread = new Thread(new ThreadStart(Co5593get_BaseStream.StartListeningTcp));
            tcpListenerThread.Start();
            Console.WriteLine("Listening");
            Thread.Sleep( 1000 );
            m_PortSetEvent.WaitOne();
            Teleport("127.0.0.1");
            Thread.Sleep( 1000 );
        } 
        catch (Exception exc_general ) 
        {
            ++iCountErrors;
            Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general.ToString());
        }
        if ( iCountErrors == 0 )
        {
            Console.WriteLine( "paSs. "+s_strTFName+" ,iCountTestcases=="+iCountTestcases.ToString());
            return true;
        }
        else
        {
            Console.WriteLine("FAiL! "+s_strTFName+" ,iCountErrors=="+iCountErrors.ToString()+" , BugNums?: "+s_strActiveBugNums );
            return false;
        }
    }
    public void printerr ( String err )

Usage Example

Beispiel #1
0
    public static void Main(String[] args)
    {
        bool bResult             = false;
        Co5593get_BaseStream cbA = new Co5593get_BaseStream();

        try
        {
            bResult = cbA.runTest();
        }
        catch (Exception exc_main)
        {
            bResult = false;
            Console.WriteLine(s_strTFAbbrev + " : FAiL! Error Err_9999zzz! Uncaught Exception in main(), exc_main==" + exc_main.ToString());
        }
        if (!bResult)
        {
            Console.WriteLine("Path: " + s_strTFName + s_strTFPath);
            Console.WriteLine(" ");
            Console.WriteLine("FAiL!  " + s_strTFAbbrev);
            Console.WriteLine(" ");
        }
        if (bResult)
        {
            Environment.ExitCode = 0;
        }
        else
        {
            Environment.ExitCode = 1;
        }
    }
All Usage Examples Of Co5593get_BaseStream::runTest