public Boolean runTest()
{
int iCountErrors = 0;
int iCountTestcases = 0;
String strLoc="123_er";
Console.Out.Write( s_strClassMethod );
Console.Out.Write( ": " );
Console.Out.Write( s_strTFPath + s_strTFName );
Console.Out.Write( ": " );
Console.Out.Write( s_strDtTmVer );
Console.Out.WriteLine( " runTest started..." );
try {
strLoc="Loc_7539fd";
iCountTestcases++;
if((int)Enum.Parse(typeof(MyEnum), "ONE", false)!=1) {
iCountErrors++;
Console.WriteLine("Err_648fd! Expected value wasn't returned");
}
iCountTestcases++;
if((int)Enum.Parse(typeof(MyEnum), "one", true)!=1) {
iCountErrors++;
Console.WriteLine("Err_648fd! Expected value wasn't returned");
}
iCountTestcases++;
if((int)Enum.Parse(typeof(MyEnum), "OnE", true)!=1) {
iCountErrors++;
Console.WriteLine("Err_648fd! Expected value wasn't returned");
}
try {
iCountTestcases++;
Enum.Parse(typeof(MyEnumLong), "One", false);
iCountErrors++;
Console.WriteLine("Err_47cdw! expected exception not thrown");
}catch(ArgumentException){
}catch(Exception ex){
iCountErrors++;
Console.WriteLine("Err_53598cd! unexpected exception thrown, " + ex);
}
iCountTestcases++;
if((int)Enum.Parse(typeof(MyEnum), "TWO", false)!=2) {
iCountErrors++;
Console.WriteLine("Err_835df! Expected value wasn't returned");
}
strLoc="Loc_7635fdd";
iCountTestcases++;
if((long)Enum.Parse(typeof(MyEnumLong), "two", true)!=2) {
iCountErrors++;
Console.WriteLine("Err_0257dfs! Expected value wasn't returned");
}
try {
iCountTestcases++;
Enum.Parse(typeof(MyEnumLong), "FOUR", true);
iCountErrors++;
Console.WriteLine("Err_47cdw! expected exception not thrown");
}catch(ArgumentException){
}catch(Exception ex){
iCountErrors++;
Console.WriteLine("Err_53598cd! unexpected exception thrown, " + ex);
}
try {
iCountTestcases++;
Enum.Parse(typeof(Int32), "FOUR", false);
iCountErrors++;
Console.WriteLine("Err_025dswom! expected exception not thrown");
}catch(ArgumentException){
}catch(Exception ex){
iCountErrors++;
Console.WriteLine("Err_0556cfd! unexpected exception thrown, " + ex);
}
try {
iCountTestcases++;
Enum.Parse(null, "FOUR", true);
iCountErrors++;
Console.WriteLine("Err_046289dfs! expected exception not thrown");
}catch(ArgumentException){
}catch(Exception ex){
iCountErrors++;
Console.WriteLine("Err_0157fs! unexpected exception thrown, " + ex);
}
try {
iCountTestcases++;
Enum.Parse(typeof(MyEnumLong), null, false);
iCountErrors++;
Console.WriteLine("Err_653dfs! expected exception not thrown");
}catch(ArgumentException){
}catch(Exception ex){
iCountErrors++;
Console.WriteLine("Err_015xs! unexpected exception thrown, " + ex);
}
}catch (Exception exc_general){
++iCountErrors;
Console.WriteLine( s_strTFAbbrev +"Error Err_8888yyy! strLoc=="+ strLoc +" ,exc_general=="+ exc_general );
}
if ( iCountErrors == 0 ){
Console.Error.WriteLine( "paSs. "+ s_strTFPath +" "+ s_strTFName +" ,iCountTestcases=="+ iCountTestcases );
return true;
} else {
Console.Error.WriteLine( "FAiL! "+ s_strTFPath +" "+ s_strTFName +" ,iCountErrors=="+ iCountErrors +" ,BugNums?: "+ s_strActiveBugNums );
return false;
}
}
public static void Main( String[] args )