当前位置: 首页>>代码示例>>C#>>正文


C# IntlStrings.GetString方法代码示例

本文整理汇总了C#中GenStrings.IntlStrings.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# IntlStrings.GetString方法的具体用法?C# IntlStrings.GetString怎么用?C# IntlStrings.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GenStrings.IntlStrings的用法示例。


在下文中一共展示了IntlStrings.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: runTest

 public bool runTest()
   {
   Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
   int iCountErrors = 0;
   int iCountTestcases = 0;
   String strLoc = "Loc_000oo";
   String strValue = String.Empty;
   try
     {
     String str1, str2;
     StringBuilder sb1;
     strLoc = "Loc_299nu";
     try {
     String.IsInterned (null);
     }
     catch (ArgumentNullException ) {
     }
     strLoc = "Loc_230ema.2";
     iCountTestcases++;
     if(String.IsInterned (new StringBuilder (String.Empty).ToString ()) == null)	
       {
       iCountErrors++;
       printerr( "Error_230a.2! String.Empty should be already interned!");
       }
     strLoc = "Loc_231loa";
     sb1 = new StringBuilder().Append("a").Append("b").Append("c").Append("d").Append("e").Append("f").Append("g").Append("h").Append("i").Append("j").Append("k").Append("l").Append("m").Append("n").Append("o").Append("p").Append("q").Append("r").Append("s").Append("t").Append("u").Append("v").Append("w").Append("x").Append("y").Append("z").Append("aa").Append("bb").Append("cc").Append("dd").Append("ee").Append("ff").Append("gg").Append("hh").Append("ii").Append("jj").Append("kk").Append("ll").Append("mm").Append("nn").Append("oo").Append("pp").Append("qq").Append("rr").Append("ss").Append("tt").Append("uu").Append("vv").Append("ww").Append("xx").Append("yy").Append("zz");
     str1 = sb1.ToString();
     strLoc = "Loc_231loa.2";
     iCountTestcases++;
     if(String.IsInterned (sb1.ToString()) != null)
       {
       iCountErrors++;
       printerr( "Error_231a.2! References of a built string can't be already interned!");
       }
     IntlStrings intl = new IntlStrings();
     sb1 = new StringBuilder().Append(intl.GetString(4, true, true)).Append(intl.GetString(8, false, true));
     str1 = sb1.ToString();
     if(String.IsInterned (sb1.ToString()) != null)
       {
       iCountErrors++;
       printerr( "Error_234949 References of a built string can't be already interned!");
       }
     strLoc = "Loc_232syma";
     sb1 = new StringBuilder().Append("abc").Append("`").Append("-").Append("=").Append("[").Append("]").Append(";").Append("'").Append(",").Append(".").Append("/").Append("~").Append("!").Append("@").Append("#").Append("$").Append("%").Append("^").Append("&").Append("*").Append("(").Append(")").Append("_").Append("+").Append("{").Append("}").Append("|").Append(":").Append("<").Append(">").Append("?");
     str1 = sb1.ToString();
     str2 = "abc`-=[];',./[email protected]#$%^&*()_+{}|:<>?";
     strLoc = "Loc_232syma.2";
     iCountTestcases++;
     if(String.IsInterned (sb1.ToString()) == null)
       {
       iCountErrors++;
       printerr( "Error_231yma.2! even though built this string should 've been interned at JIT time!");
       }
     } catch (Exception exc_general ) {
     ++iCountErrors;
     Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general.ToString());
     }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
开发者ID:ArildF,项目名称:masters,代码行数:60,代码来源:co4825isinterned.cs

示例2: runTest

 public bool runTest()
   {
   Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
   int iCountErrors = 0;
   int iCountTestcases = 0;
   String strLoc = "Loc_000oo";
   String strValue = String.Empty;
   try
     {
     strLoc = "Loc_299cu";
     iCountTestcases++;
     if(!String.Concat(null,null,null).Equals(String.Empty))
       {
       iCountErrors++;
       printerr( "Error_2029s! String.Empty not returned as expected");
       }
     strLoc = "Loc_109xh";
     iCountTestcases++;
     if(!String.Concat("Hello","World","End").Equals("HelloWorldEnd"))
       {
       iCountErrors++;
       printerr( "Error_209sj! Expected==HelloWorldEnd");
       }
     iCountTestcases++;
     if(!String.Concat("Hi", null, "There").Equals("HiThere"))
       {
       iCountErrors++;
       printerr( "Error_2091x! Expected==HiThere");
       }
     iCountTestcases++;
     if(!String.Concat(null, "Hi", "There").Equals("HiThere"))
       {
       iCountErrors++;
       printerr( "Error_099xj! Expected==HiThere");
       }
     iCountTestcases++;
     if(!String.Concat("Hi", "There", null).Equals("HiThere"))
       {
       iCountErrors++;
       printerr( "Error_1909x! Expected==HiThere");
       }
     IntlStrings intl = new IntlStrings();
     String str1 = intl.GetString(3, true, true);
     String str2 = intl.GetString(5, true, true);
     if(!String.Concat(str1,str2).Equals(String.Concat(str1, str2, null)))
       {
       iCountErrors++;
       printerr( "Error_209sj! Expected==HelloWorld");
       }
     } catch (Exception exc_general ) {
     ++iCountErrors;
     Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general.ToString());
     }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
开发者ID:ArildF,项目名称:masters,代码行数:56,代码来源:co5465concat_ooo.cs

示例3: runTest

 public virtual bool runTest()
   {
   int iCountErrors = 0;
   int iCountTestcases = 0;
   Console.Out.Write( strName );
   Console.Out.Write( ": " );
   Console.Out.Write( strTest );
   Console.Out.WriteLine( " runTest started..." );
   String strFromStrStr = null;
   String strAlphabets = "abcdefghijklmnopqrstuvwxyz";
   String strDigits = "0123456789";
   do
     {
     IntlStrings intl = new IntlStrings();
     String testString = intl.GetString(12, true, true);
     String testString2 = intl.GetString(3, true, true);
     Console.Out.WriteLine( "[] Construct a string from two strings" );
     try
       {
       strFromStrStr =  testString + testString2 ;
       if ( strFromStrStr == null )
	 {
	 Console.WriteLine( strTest+ "E_101" );
	 Console.WriteLine( strTest+ "Failed to construct valid string" );
	 ++iCountErrors;
	 break;
	 }
       if ( strFromStrStr.Equals( testString + testString2 ) != true )
	 {
	 String strInfo = strTest + " error: ";
	 strInfo = strInfo + "Expected string<" + strAlphabets + strDigits + ">\n";
	 strInfo = strInfo + "Returned character <" + strFromStrStr + ">";
	 Console.WriteLine( strTest+ "E_202" );
	 Console.WriteLine( strTest+ strInfo );
	 ++iCountErrors;
	 break;
	 }
       }
     catch (Exception ex)
       {
       Console.WriteLine( strTest+ "E_303" );
       Console.WriteLine( strTest+ "Unexpected Exception: " + ex.ToString() );
       ++iCountErrors;
       break;
       }
     strFromStrStr =  strAlphabets+ strDigits ;
     }
   while ( false );
   Console.Error.Write( strName );
   Console.Error.Write( ": " );
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
开发者ID:ArildF,项目名称:masters,代码行数:53,代码来源:co3130ctor_strstr.cs

示例4: runTest

 public bool runTest()
   {
   Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
   int iCountErrors = 0;
   int iCountTestcases = 0;
   String strLoc = "Loc_000oo";
   String strValue = String.Empty;
   try
     {
     String str1;
     Object obj1;
     strLoc = "Loc_299cu";
     obj1 = null;
     iCountTestcases++;
     if(String.Concat(obj1) != String.Empty)
       {
       iCountErrors++;
       printerr( "Error_2029s! String.Empty not returned as expected");
       }
     IntlStrings intl = new IntlStrings();
     str1 = intl.GetString(20, false, true);
     iCountTestcases++;
     if(!String.Concat(str1).Equals((object)str1))
       {
       iCountErrors++;
       printerr( "Error_209sj! got value=="+String.Concat(str1));
       }
     } catch (Exception exc_general ) {
     ++iCountErrors;
     Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general.ToString());
     }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:34,代码来源:co5463concat_obj.cs

示例5: IntlStrings

 public virtual bool runTest
   ()
   {
   int nErrorBits = 0; 
   System.String swrString2 = null;
   System.String swrString4 = null;
   IntlStrings intl = new IntlStrings();
   swrString2 = intl.GetString(50, false, true);
   swrString4 = swrString2.ToLower();
   Console.WriteLine(swrString4);
   foreach(Char c in swrString4) {
   if(Char.GetUnicodeCategory( c ) == UnicodeCategory.UppercaseLetter) {
   nErrorBits = nErrorBits | 0x1;
   }
   }
   System.Console.Error.WriteLine(nErrorBits );
   if (nErrorBits == 0)
     {
     return true; 
     }
   else
     {
     return false; 
     }
   }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:25,代码来源:co1010tolower.cs

示例6: IntlStrings

 public virtual bool runTest
   ()
   {
   System.Console.Error.WriteLine( "String.EndsWith: Co1150EW runTest starting..." );
   int nErrorBits = 0; 
   System.String swrString2 = null;
   swrString2 = "nOpqRs";
   if ( swrString2.EndsWith( "qRs" ) != true ) 
     nErrorBits = nErrorBits | 0x1;
   if ( swrString2.EndsWith( "qrs" ) != false )
     nErrorBits = nErrorBits | 0x2;
   if ( swrString2.EndsWith( "nOp" ) != false )
     nErrorBits = nErrorBits | 0x4;
   Char[] swrString3 = new Char[8];
   IntlStrings intl = new IntlStrings();
   swrString2 = intl.GetString(10, true, true);
   swrString2.CopyTo(2, swrString3, 0, swrString2.Length - 2);
   String swrString4 = new String(swrString3);
   if(swrString2.EndsWith(swrString4) != true) {
   nErrorBits = nErrorBits | 0x1;
   }
   System.Console.Error.WriteLine( nErrorBits  );
   if (nErrorBits == 0)
     {
     return true; 
     }
   else
     {
     return false; 
     }
   }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:31,代码来源:co1150endswith_str.cs

示例7: runTest

 public virtual bool runTest()
   {
   Console.Error.WriteLine( "Co1454ctor_Strings.  runTest started." );
   int iCountErrors = 0;
   StringBuilder sbl2 = null;
   String str2b = null;
   String str2c = null;
   String str2d = null;
   String str2e = null;
   String str2_All = null;
   String str2_Some = null;
   String str9 = null;
   IntlStrings intl = new IntlStrings();
   str9 = intl.GetString(6, true, true);
   str2_All = str9;
   if ( ! str9.Equals( str2_All ) )
     {
     iCountErrors += 1;
     Console.Error.WriteLine(  "POINTTOBREAK:  Error E_6555im! (Co1454ctor_Strings)"  );
     }
   str2b = "Bb";
   str2c = "Cc";
   str2d = "Dd";
   str2e = "Ee";
   str2_All = "BbCcDdEe";
   str9 =  "BbCcDdEe" ;
   if ( ! str9.Equals( str2_All ) )
     {
     iCountErrors += 1;
     Console.Error.WriteLine(  "POINTTOBREAK:  Error E_638im! (Co1454ctor_Strings)"  );
     }
   sbl2 = new StringBuilder( "BbCcDd" );
   sbl2.Append( str2e );
   str9 = sbl2.ToString();
   if ( ! str9.Equals( str2_All ) )
     {
     iCountErrors += 1;
     Console.Error.WriteLine(  "POINTTOBREAK:  Error E_517cw! (Co1454ctor_Strings)"  );
     }
   str9 =  "Bb" + "Cc" +"Dd" ;
   str2_Some = "BbCcDd";
   if ( ! str9.Equals( str2_Some ) )
     {
     iCountErrors += 1;
     Console.Error.WriteLine(  "POINTTOBREAK:  Error E_460is! (Co1454ctor_Strings)"  );
     }
   str9 =  str2b + str2c + str2d ;
   str9 = new StringBuilder( str9 ).Append( str2e ).ToString();
   if ( ! str9.Equals( str2_All ) )
     {
     iCountErrors += 1;
     Console.Error.WriteLine(  "POINTTOBREAK:  Error E_253xi! (Co1454ctor_Strings)"  );
     }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:56,代码来源:co1454ctor_strings.cs

示例8: runTest

 private Boolean runTest(double timeInterval, int repetitions)
   {
   try
     {
     String emptyString="";
     emptyString=emptyString.Replace ('r', 't');
     IntlStrings intl = new IntlStrings();
     String testingString = intl.GetString(7, true, true);
     String copyTestString = testingString;
     Char charVar = testingString[4];
     testingString = testingString.Replace(testingString[4], 'h');
     testString(copyTestString, testingString, copyTestString[4], 'h', "Rep_cc-1");
     testString ("Yehia", "Ye7ia", 'h', '7', "Rep_cc00");	
     iCountTestcases++;
     testString ("Redmond", "Redmond", 'x', 'd', "Rep_cc01");      
     testString ("Redmond", "Redmond", 'd', 'd', "Rep_cc02");      
     iCountTestcases++;
     iCountTestcases++;
     testString ("Redmond", "redmond", 'R', 'r', "Rep_cc03");     
     testString ("Redmond", "Redmond", 'r', 'c', "Rep_cc04");     
     testString ("Redmond", "Re mon ", 'd', ' ', "Rep_cc05");     
     iCountTestcases++;
     testString ("Reddod", "Rexxox", 'd', 'x', "Rep_cc06");     
     testString ("Redmo", "Rexmo", 'd', 'x', "Rep_cc07");     
     iCountTestcases++;
     testString ("Null", "N"+'\u0000'+"ll", 'u', '\u0000', "Rep_cc08");	
     testString ("In", "I"+'\uFFFF', 'n', '\uFFFF', "Rep_cc09");		
     testString (" ", " ", ' ', ' ', "Rep_cc10");	
     testString ("  ", "aa", ' ', 'a', "Rep_cc11");	
     testString ("Seattle", "Sea"+'\n'+'\n'+"le", 't', '\n', "Rep_cc12");	
     testString ("Seattle", "Sea"+'\r'+'\r'+"le", 't', '\r', "Rep_cc13");			
     testString ("Seattle", "Sea"+'\t'+'\t'+"le", 't', '\t', "Rep_cc14");
     testString ("Seattle", "Sea"+'\\'+'\\'+"le", 't', '\\', "Rep_cc15");			
     testString ("Seattle", "Sea"+'\a'+'\a'+"le", 't', '\a', "Rep_cc16");
     testString ("Seattle", "Sea"+'\0'+'\0'+"le", 't', '\0', "Rep_cc17");
     for (int index=0; index<repetitions; index++) {
     Console.WriteLine ("Finished "+index+" repetition(s)");
     randomTest (timeInterval);	
     }
     }
   catch (Exception ex)
     {
     ++iCountErrors;
     String strInfo =  "Unexpected Exception: (runTest)" ;
     strInfo = strInfo + ex.ToString() ;
     Console.Error.WriteLine (strName+" "+strTest+" "+strPath);
     Console.Error.WriteLine (strInfo);
     }
   Console.WriteLine ("FINAL TEST RESULT:" + strName+" "+strTest+" "+strPath);
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:52,代码来源:co2345replace_cc.cs

示例9: IntlStrings

 public virtual bool runTest
   ()
   {
   Console.Error.WriteLine( "String.Equals: Cb1100E runTest running:" );
   int nErrorBits = 0; 
   String swrString1 = null;
   String swrString2 = null;
   String swrString3 = null;
   String swrString4 = null;
   String swrString5 = null;
   String swrString6 = null;
   swrString2 = "nOpqrs"; 
   swrString3 = "nopqrs"; 
   swrString4 = "Dill Guv Dill Guv Dill"; 
   swrString5 = "Dill Guv Dill Guv Dill Guv Dill"; 
   swrString6 = "Y2"; 
   swrString1 = swrString2; 
   if ( String.Equals( swrString1, swrString2 ) != true ) 
     nErrorBits = nErrorBits | 0x1;
   if ( String.Equals( swrString1, swrString3 ) != false ) 
     nErrorBits = nErrorBits | 0x2;
   IntlStrings intl = new IntlStrings();
   String str1 = intl.GetString(3, true, true);
   String str2 =  str1;
   if(!str1.Equals(str2))
     {
     nErrorBits = nErrorBits | 0x20;
     }
   swrString1 = swrString4; 
   if ( String.Equals( swrString1, swrString5 ) != false ) 
     nErrorBits = nErrorBits | 0x4; 
   if ( String.Equals( swrString1, swrString6 ) != false ) 
     nErrorBits = nErrorBits | 0x8;
   swrString1 = swrString5; 
   if ( String.Equals( swrString1, swrString4 ) != false ) 
     nErrorBits = nErrorBits | 0x10;
   Console.Error.Write( "String.Equals: Cb1100E nErrorBits==" );
   Console.Error.WriteLine( nErrorBits  );
   if (nErrorBits == 0)
     {
     return true; 
     }
   else
     {
     return false; 
     }
   }
开发者ID:ArildF,项目名称:masters,代码行数:47,代码来源:co5151equals_str_str.cs

示例10: IntlStrings

 public virtual bool runTest
   ()
   {
   System.Console.Error.WriteLine( "String.Equals: Co1100E runTest running:" );
   int nErrorBits = 0; 
   System.String swrString1 = null;
   System.String swrString2 = null;
   System.String swrString3 = null;
   System.String swrString4 = null;
   System.String swrString5 = null;
   System.String swrString6 = null;
   System.String swrString7 = null;
   System.String swrString8 = null;
   swrString2 = "nOpqrs"; 
   swrString3 = "nopqrs"; 
   swrString4 = "Dill Guv Dill Guv Dill"; 
   swrString5 = "Dill Guv Dill Guv Dill Guv Dill"; 
   swrString6 = "Y2"; 
   swrString1 = swrString2; 
   IntlStrings intl = new IntlStrings();
   swrString7 = intl.GetString(10, false, true);
   swrString8 = swrString7;
   if ( swrString7.Equals( swrString8 ) != true ) 
     nErrorBits = nErrorBits | 0x1;
   if ( swrString1.Equals( swrString3 ) != false ) 
     nErrorBits = nErrorBits | 0x2;
   swrString1 = swrString4; 
   if ( swrString1.Equals( swrString5 ) != false ) 
     nErrorBits = nErrorBits | 0x4; 
   if ( swrString1.Equals( swrString6 ) != false ) 
     nErrorBits = nErrorBits | 0x8;
   swrString1 = swrString5; 
   if ( swrString1.Equals( swrString4 ) != false ) 
     nErrorBits = nErrorBits | 0x10;
   System.Console.Error.Write( "String.Equals: Co1100E nErrorBits==" );
   System.Console.Error.WriteLine( nErrorBits  );
   if (nErrorBits == 0)
     {
     return true; 
     }
   else
     {
     return false; 
     }
   }
开发者ID:ArildF,项目名称:masters,代码行数:45,代码来源:co1100equals_str.cs

示例11: runTest

 public virtual bool runTest()
   {
   Console.Out.WriteLine( "String\\Co3041ToString. runTest() started." );
   int iCountErrors = 0;
   int iCountTestcases = 0;
   String str1 = null;
   iCountTestcases++;
   IntlStrings intl = new IntlStrings();
   str1 = intl.GetString(17, false, true);
   if(!(str1.ToString().Equals(str1)))
     {
     iCountErrors++;
     Console.Error.WriteLine("POINTTOBREAK: find E_498o (Co3041ToString.)");
     }
   iCountTestcases++;
   str1 = "4874378828457y34";
   if(!(str1.ToString().Equals(str1)))
     {
     iCountErrors++;
     Console.Error.WriteLine("POINTTOBREAK: find E_433r (Co3041ToString.)");
     }
   iCountTestcases++;
   str1 = "#$%@#$%@*#[email protected]_!__!_!($#%JWE(@JA)(*#@$";
   if(!(str1.ToString().Equals(str1)))
     {
     iCountErrors++;
     Console.Error.WriteLine("POINTTOBREAK: find E_879u (Co3041ToString.)");
     }
   iCountTestcases++;
   str1 = "\0";
   if(!(str1.ToString().Equals(str1)))
     {
     iCountErrors++;
     Console.Error.WriteLine("POINTTOBREAK: find E_899 (Co3041ToString.)");
     }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:38,代码来源:co3041tostring.cs

示例12: IntlStrings

 public virtual bool runTest
   ()
   {
   int nErrorBits = 0; 
   int n2 = 0;
   System.String swrString2 = null;
   IntlStrings intl = new IntlStrings();
   swrString2 =  "" ;
   if ( swrString2.Length != 0x0)
     nErrorBits = nErrorBits | 0x1;
   swrString2 =  intl.GetString(6 , true, true);
   if ( swrString2.Length != 6)
     nErrorBits = nErrorBits | 0x2;
   if ( swrString2.Length != 6)
     nErrorBits = nErrorBits | 0x4;
   System.Console.Error.WriteLine( nErrorBits);
   if (nErrorBits == 0){
   return true; 
   }
   else {
   return false; 
   }
   }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:23,代码来源:co1022get_length.cs

示例13: runTest


//.........这里部分代码省略.........
   } catch (ArgumentException ) {}
   catch ( Exception exc) {
   iCountErrors++;
   Console.WriteLine( s_strTFAbbrev+ "Err_9083u! , exc=="+exc);
   }
   strLoc = "Loc_129ew";
   str1 = "\t\t";
   strInsert = "  ";
   iStartIndex = 3;
   iCountTestcases++;
   try {
   str1.Insert(iStartIndex, strInsert);
   iCountErrors++;
   Console.WriteLine( s_strTFAbbrev+ "Err_983uq");
   } catch ( ArgumentException) {}
   catch ( Exception exc) {
   iCountErrors++;
   Console.WriteLine( s_strTFAbbrev+ "Err_5388g! , exc=="+exc);
   }
   strLoc = "Loc_538wi";
   str1 = "\t\t";
   strInsert = null;
   iStartIndex = 0;
   iCountTestcases++;
   try {
   str1.Insert(iStartIndex, strInsert);
   iCountErrors++;
   Console.WriteLine( s_strTFAbbrev+ "Err_128qu");
   } catch ( ArgumentException) {}
   catch ( Exception exc) {
   iCountErrors++;
   Console.WriteLine( s_strTFAbbrev+ "Err_3948u! , exc=="+exc);
   }
   strLoc = "Loc_3894u";
   str1 = "";
   strInsert = "This is a string";
   iStartIndex = 0;
   iCountTestcases++;
   if (!str1.Insert(iStartIndex, strInsert).Equals(strInsert))
     {
     iCountErrors++;
     Console.WriteLine( s_strTFAbbrev+ "Err_438du");
     }
   IntlStrings intl = new IntlStrings();
   str1 = intl.GetString(19, true, true);
   strInsert = intl.GetString(12, false, true);
   iStartIndex = 0;
   iCountTestcases++;
   if (!str1.Insert(iStartIndex, strInsert).Equals(String.Concat(strInsert, str1)))
     {
     iCountErrors++;
     Console.WriteLine( s_strTFAbbrev+ "Err_299138du");
     }
   strLoc = "Loc_3948r";
   str1 = "This is a string";
   strInsert = "\t\t\t\t";
   iStartIndex = 0;
   iCountTestcases++;
   if(!str1.Insert(iStartIndex, strInsert).Equals("\t\t\t\tThis is a string"))
     {
     iCountErrors++;
     Console.WriteLine( s_strTFAbbrev+ "Err_8904e");
     }
   strLoc = "Loc_3498j";
   str1 = "This is a \n\n";
   strInsert = "string";
   iStartIndex = str1.ToCharArray().Length;
   iCountTestcases++;
   if(!str1.Insert(iStartIndex, strInsert).Equals(str1+strInsert))
     {
     iCountErrors++;
     Console.WriteLine( s_strTFAbbrev+ "Err_1289m");
     }
   strLoc = "Loc_3487y";
   str1 = "\t is a string";
   strInsert = "This\t";
   iStartIndex = 1;
   iCountTestcases++;
   if(!str1.Insert(iStartIndex, strInsert).Equals("\tThis\t is a string"))
     {
     iCountErrors++;
     Console.WriteLine( s_strTFAbbrev+ "Err_3739c");
     }
   strLoc = "Loc_238us";
   str1 = "This is a string";
   strInsert = "[email protected]#$%^&*()";
   iStartIndex = str1.ToCharArray().Length-1;
   iCountTestcases++;
   if(!str1.Insert(iStartIndex, strInsert).Equals("This is a [email protected]#$%^&*()g"))
     {
     iCountErrors++;
     Console.WriteLine( s_strTFAbbrev+ "Err_34fdy");
     }
   } catch (Exception exc_general ) {
   ++iCountErrors;
   Console.WriteLine(s_strTFAbbrev +" Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general);
   }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:co5155insert_is.cs

示例14: runTest

 public bool runTest()
   {
   Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
   int iCountErrors = 0;
   int iCountTestcases = 0;
   String strLoc = "Loc_000oo";
   String strValue = String.Empty;
   try
     {
     String str1 = String.Empty, str2 = String.Empty;
     strLoc = "Loc_498hv";
     iCountTestcases++;
     str1 = String.Concat (String.Empty);
     str2 = String.Copy (str1);
     if(!str2.Equals(String.Empty))
       {
       iCountErrors++;
       printerr( "Error_498ch! incorrect string returned for null argument=="+str2);
       } 
     strLoc = "Loc_498hv.2";
     iCountTestcases++;
     if(str1 != str2)
       {
       iCountErrors++;
       printerr( "Error_498ch.2! str1 != str2; str2 == "+ str2);
       } 
     strLoc = "Loc_498hv.3";
     str1 = "Hi There";
     str2 = String.Copy (str1);
     iCountTestcases++;
     if(!str2.Equals ("Hi There"))
       {
       iCountErrors++;
       printerr( "Error_498ch.3! incorrect string returned for null argument=="+str2);
       } 
     IntlStrings intl = new IntlStrings();
     str1 = intl.GetString(12, false, true);
     str2 = String.Copy (str1);
     String str3 = str1;
     iCountTestcases++;
     if(!str2.Equals (str3))
       {
       iCountErrors++;
       printerr( "Error_498ch.3! incorrect string returned for null argument=="+str2);
       }
     strLoc = "Loc_498hv.4";
     iCountTestcases++;
     if(str1 != str2)
       {
       iCountErrors++;
       printerr( "Error_498ch.4! str1 != str2; str2 == "+ str2);
       } 
     strLoc = "Loc_498hv.5";
     iCountTestcases++;
     try {
     str2 = String.Copy (null);
     iCountErrors++;
     printerr( "Error_498ch.5! expected argnullexc; instead resturned "+str2);
     }
     catch (ArgumentNullException ) {
     }
     } catch (Exception exc_general ) {
     ++iCountErrors;
     Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general.ToString());
     }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
开发者ID:ArildF,项目名称:masters,代码行数:68,代码来源:co4833copy.cs

示例15: runTest

 public Boolean runTest()
   {
   int iCountErrors = 0;
   int iCountTestcases = 0;
   String strLoc="123_er";
   String strInfo = null;
   Console.Out.Write( strName );
   Console.Out.Write( ": " );
   Console.Out.Write( strPath + strTest );
   Console.Out.WriteLine( " runTest started..." );
   String str1 = "Dill Guv Dill Guv Dill" ;
   Char[] chArr1 = {'G', 'M', 'X', 'Y', 'Z'}; 
   Char[] chArr2 = null; 
   Char[] chArr3 = {}; 
   String str2 = "abcd" ;
   Char[] chArr91 = new Char[] { 'a' ,'b' ,'c' };
   Int32 iAA;
   try
     {
     int iResult = 0;
     int[] iArrInvalidValues = new Int32[]{ -1, -2, -100, -1000, -10000, -100000, -1000000, -10000000, -100000000, -1000000000, Int32.MinValue};
     int[] iArrLargeValues = new Int32[]{ Int32.MaxValue, Int32.MaxValue-1, Int32.MaxValue/2 , Int32.MaxValue/10 , Int32.MaxValue/100, 100000, 10000, 1000, 100, 21 };
     int[] iArrValidValues = new Int32[]{ 100000, 99999 , 10000 , 1000, 100, 10, 3 };
     IntlStrings intl = new IntlStrings();
     String intlString = intl.GetString(20, true, true); 
     str1 = intlString.Substring( 5, 5);   
     iCountTestcases++;
     for(int iLoop = 0 ; iLoop < iArrInvalidValues.Length ; iLoop++ ){
     try
       {
       iResult = str1.LastIndexOfAny( chArr1 , iArrInvalidValues[iLoop], 5 );
       iCountErrors++;
       Console.WriteLine("Error_0000!!! Expected exception not occured...");
       } catch ( ArgumentOutOfRangeException ){
       } catch ( Exception ex )
	 {
	 Console.WriteLine( "Error_2222!!! Unexpected exception " + ex.ToString() );
	 iCountErrors++ ;
	 }
     }
     iCountTestcases++;
     for(int iLoop = 0 ; iLoop < iArrInvalidValues.Length ; iLoop++ ){
     try
       {
       iResult = str1.LastIndexOfAny( chArr1 , 5, iArrInvalidValues[iLoop] );
       iCountErrors++;
       Console.WriteLine("Error_1111!!! Expected exception not occured...");
       } catch ( ArgumentOutOfRangeException ){
       } catch ( Exception ex )
	 {
	 Console.WriteLine( "Error_3333!!! Unexpected exception " + ex.ToString() );
	 iCountErrors++ ;
	 }
     }
     iCountTestcases++;
     for(int iLoop = 0 ; iLoop < iArrLargeValues.Length ; iLoop++ ){
     try
       {
       iResult = intlString.LastIndexOfAny( chArr1 , iArrLargeValues[iLoop], 5 );
       iCountErrors++;
       Console.WriteLine("Error_4444!!! Expected exception not occured...");                
       } catch ( ArgumentOutOfRangeException ){
       } catch ( Exception ex )
	 {
	 Console.WriteLine( "Error_5555!!! Unexpected exception " + ex.ToString() );
	 iCountErrors++ ;                                                             
	 }
     }
     iCountTestcases++;
     for(int iLoop = 0 ; iLoop < iArrLargeValues.Length ; iLoop++ ){
     try
       {
       iResult = intlString.LastIndexOfAny( chArr1 , 5, iArrLargeValues[iLoop] );
       iCountErrors++;
       Console.WriteLine("Error_6666!!! Expected exception not occured...");                
       } catch ( ArgumentOutOfRangeException ){
       } catch ( Exception ex )
	 {
	 Console.WriteLine( "Error_7777!!! Unexpected exception " + ex.ToString() );
	 iCountErrors++ ;                                                             
	 }
     }
     iCountTestcases++;
     intlString = intl.GetString(100002, true, true);  
     chArr1 = intlString.Substring( 0, 2).ToCharArray();      
     for(int iLoop = 0 ; iLoop < iArrValidValues.Length ; iLoop++ ){
     try
       {                            
       iResult = intlString.LastIndexOfAny( chArr1 , iArrValidValues[iLoop]-1, iArrValidValues[iLoop] );
       if ( iResult == -1 ){
       iCountErrors++;
       Console.WriteLine( "Error_8888!!!! Incorrect LastIndexOfAny value.... Actual...{0}", iResult );
       }
       } catch ( Exception ex ){
       Console.WriteLine( "Error_9999!!! Unexpected exception " + ex.ToString() );
       iCountErrors++ ;
       }
     }
     str1 = "Dill Guv Dill Guv Dill" ;
     chArr1 = new Char[]{'G', 'M', 'X', 'Y', 'Z'}; 
//.........这里部分代码省略.........
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:101,代码来源:co3425lastindexof_chararrintint.cs


注:本文中的GenStrings.IntlStrings.GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。