本文整理汇总了C#中GenStrings.IntlStrings类的典型用法代码示例。如果您正苦于以下问题:C# IntlStrings类的具体用法?C# IntlStrings怎么用?C# IntlStrings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntlStrings类属于GenStrings命名空间,在下文中一共展示了IntlStrings类的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;}
}
示例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
{
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;}
}
示例3: 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;
}
}
示例4: 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;
}
}
示例5: Main
public static void Main()
{
IntlStrings intl = new IntlStrings( 0x41F );
Console.WriteLine(intl.GetRandomDirectoryName( 5 ));
for(int iLoop = 0 ; iLoop < 5 ; iLoop++)
Console.WriteLine( intl.GetTop20String( 20, true, true ));
for(int iLoop = 0 ; iLoop < 5 ; iLoop++)
Console.WriteLine( intl.GetProbCharString( 20, true, true ));
}
示例6: 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;}
}
示例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;}
}
示例8: 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;}
}
示例9: 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;}
}
示例10: 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;
}
}
示例11: 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;
}
}
示例12: 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;}
}
示例13: 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;
}
}
示例14: runTest
public Boolean runTest()
{
int iCountErrors = 0;
int iTestCases = 0;
Console.Out.Write( strName );
Console.Out.Write( ": " );
Console.Out.Write( strTest );
Console.Out.WriteLine( " runTest started..." );
int ii = 0;
String strAlphabets = "abcdefghijklmnopqrstuvwxyz";
String strDigits = "0123456789";
char[] charArray = null;
char[] charAlphabets = { 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z' };
char[] charDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
char[] charBuffer = new char[256];
IntlStrings intl = new IntlStrings();
char[] MyCharArr = new char[2];
char[] CopyArr = new char[2];
MyCharArr[0] = (intl.GetString(1, true, true))[0];
MyCharArr[1] = (intl.GetString(1, true, true))[0];
String intlString = new String(MyCharArr);
CopyArr = intlString.ToCharArray();
if((CopyArr[0] != MyCharArr[0]) || (CopyArr[1] != MyCharArr[1]) ) {
iCountErrors++;
}
do
{
++iTestCases;
Console.Out.WriteLine( "[] Obtain char array for entire string" );
try
{
strAlphabets.CopyTo( 0, charBuffer, 0, strAlphabets.Length );
if ( charBuffer == null )
{
Console.WriteLine( strTest+ "E_101" );
Console.WriteLine( strTest+ "Failed to return valid buffer" );
++iCountErrors;
break;
}
}
catch (Exception ex)
{
Console.WriteLine( strTest+ "E_202" );
Console.WriteLine( strTest+ "Unexpected Exception: " + ex.ToString() );
++iCountErrors;
break;
}
for ( ii = 0; ii < charAlphabets.Length; ++ii )
{
if ( charAlphabets[ii] != charBuffer[ii] )
{
String strInfo = strTest + " error: ";
strInfo = strInfo + "On character item " + ii + " ";
strInfo = strInfo + "Expected character <" + (charAlphabets[ii]).ToString() + ">\n";
Console.WriteLine( strTest+ "E_303" );
Console.WriteLine( strTest+ strInfo );
++iCountErrors;
break;
}
}
++iTestCases;
Console.Out.WriteLine( "[] Obtain char array for substring" );
try
{
strAlphabets.CopyTo(12, charBuffer, 20, 5 );
if ( charBuffer == null )
{
Console.WriteLine( strTest+ "E_404" );
Console.WriteLine( strTest+ "Failed to return valid buffer" );
++iCountErrors;
break;
}
}
catch (Exception ex)
{
Console.WriteLine( strTest+ "E_505" );
Console.WriteLine( strTest+ "Unexpected Exception: " + ex.ToString() );
++iCountErrors;
break;
}
for ( ii = 0; ii < 5; ++ii )
{
if ( charAlphabets[ii+12] != charBuffer[ii+20] )
{
String strInfo = strTest + " error: ";
strInfo = strInfo + "On character item " + ii + " ";
strInfo = strInfo + "Expected character <" + (charAlphabets[ii+12]).ToString() + ">\n";
strInfo = strInfo + "Returned character <" + (charBuffer[ii+20]).ToString() + ">";
Console.WriteLine( strTest+ "E_606" );
Console.WriteLine( strTest+ strInfo );
++iCountErrors;
break;
}
}
++iTestCases;
Console.Out.WriteLine( "[] Index out of range" );
try
//.........这里部分代码省略.........
示例15: Test01
public void Test01()
{
IntlStrings intl;
StringCollection sc;
// simple string values
string[] values =
{
"",
" ",
"a",
"aa",
"text",
" spaces",
"1",
"$%^#",
"2222222222222222222222222",
System.DateTime.Today.ToString(),
Int32.MaxValue.ToString()
};
int cnt = 0; // Count
// initialize IntStrings
intl = new IntlStrings();
// [] StringCollection is constructed as expected
//-----------------------------------------------------------------
sc = new StringCollection();
// [] on empty collection
//
for (int i = 0; i < values.Length; i++)
{
if (sc.Contains(values[i]))
{
Assert.False(true, string.Format("Error, returned true for empty collection", i));
}
}
// [] add simple strings and verify Contains()
//
cnt = sc.Count;
sc.AddRange(values);
if (sc.Count != values.Length)
{
Assert.False(true, string.Format("Error, count is {0} instead of {1}", sc.Count, values.Length));
}
for (int i = 0; i < values.Length; i++)
{
// verify that collection contains all added items
//
if (!sc.Contains(values[i]))
{
Assert.False(true, string.Format("Error, collection doesn't contain item \"{1}\"", i, values[i]));
}
}
//
// Intl strings
// [] add Intl strings and verify Contains()
//
string[] intlValues = new string[values.Length];
// fill array with unique strings
//
for (int i = 0; i < values.Length; i++)
{
string val = intl.GetRandomString(MAX_LEN);
while (Array.IndexOf(intlValues, val) != -1)
val = intl.GetRandomString(MAX_LEN);
intlValues[i] = val;
}
int len = values.Length;
Boolean caseInsensitive = false;
for (int i = 0; i < len; i++)
{
if (intlValues[i].Length != 0 && intlValues[i].ToLower() == intlValues[i].ToUpper())
caseInsensitive = true;
}
cnt = sc.Count;
sc.AddRange(intlValues);
if (sc.Count != (cnt + intlValues.Length))
{
Assert.False(true, string.Format("Error, count is {0} instead of {1}", sc.Count, cnt + intlValues.Length));
}
for (int i = 0; i < intlValues.Length; i++)
{
// verify that collection contains all added items
//
if (!sc.Contains(intlValues[i]))
//.........这里部分代码省略.........