public virtual bool runTest()
{
int iCountErrors = 0;
int iCountTestcases = 0;
Console.Error.WriteLine( strName + ": " + strTest + " runTest started..." );
ArrayList arrList = null;
String[] arrCopy = null;
String [] strHeroes =
{
"Aquaman",
"Atom",
"Batman",
"Black Canary",
"Captain America",
"Captain Atom",
"Catwoman",
"Cyborg",
"Flash",
"Green Arrow",
"Green Lantern",
"Hawkman",
"Huntress",
"Ironman",
"Nightwing",
"Robin",
"SpiderMan",
"Steel",
"Superman",
"Thor",
"Wildcat",
"Wonder Woman",
};
do
{
++iCountTestcases;
Console.Error.WriteLine( "[] Construct ArrayList" );
try
{
arrList = new ArrayList( (ICollection) strHeroes );
if ( arrList == null )
{
Console.WriteLine( strTest+ "E_101: Failed to construct new ArrayList" );
++iCountErrors;
break;
}
}
catch (Exception ex)
{
Console.WriteLine( strTest+ "E_10001: Unexpected Exception: " + ex.ToString() );
++iCountErrors;
break;
}
++iCountTestcases;
Console.Error.WriteLine( "[] Obtain list capacity" );
try
{
int nCapacity = arrList.Capacity;
int nSize = arrList.Count;
if ( nCapacity < nSize )
{
String strInfo = strTest + " error: ";
strInfo = strInfo + "Capacity == <"+ nCapacity + "> ";
strInfo = strInfo + "Size <"+ nSize + "> ";
Console.WriteLine( strTest+ "E_202: " + strInfo );
++iCountErrors;
break;
}
}
catch (Exception ex)
{
Console.WriteLine( strTest+ "E_10002: Unexpected Exception: " + ex.ToString() );
++iCountErrors;
break;
}
}
while ( false );
Console.Error.Write( strName );
Console.Error.Write( ": " );
if ( iCountErrors == 0 )
{
Console.Error.WriteLine( strTest + " iCountTestcases==" + iCountTestcases + " paSs" );
return true;
}
else
{
System.String strFailMsg = null;
Console.WriteLine( strTest+ strPath );
Console.WriteLine( strTest+ "FAiL" );
Console.Error.WriteLine( strTest + " iCountErrors==" + iCountErrors );
return false;
}
}
public static void Main( String[] args )