2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / corlib / Test / System.Collections / CaseInsensitiveHashCodeProviderTest.cs
1 // CaseInsensitiveHashCodeProviderTest\r
2 \r
3 using System;\r
4 using System.Collections;\r
5 \r
6 using NUnit.Framework;\r
7 \r
8 \r
9 \r
10 namespace MonoTests.System.Collections {\r
11 \r
12 \r
13         /// <summary>CaseInsensitiveHashCodeProvider test suite.</summary>\r
14         public class CaseInsensitiveHashCodeProviderTest : TestCase {\r
15                 protected override void SetUp ()\r
16                 {\r
17                 }\r
18 \r
19                 public void TestDefaultInstance ()\r
20                 {\r
21                         // Make sure the instance returned by Default\r
22                         // is really a CaseInsensitiveHashCodeProvider.\r
23                         Assert((CaseInsensitiveHashCodeProvider.Default\r
24                                 as CaseInsensitiveHashCodeProvider) != null);\r
25                 }\r
26 \r
27                 public void TestHashCode () {\r
28                         CaseInsensitiveHashCodeProvider cih = new CaseInsensitiveHashCodeProvider ();\r
29                         int h1 = cih.GetHashCode ("Test String");\r
30                         int h2 = cih.GetHashCode ("test string");\r
31                         int h3 = cih.GetHashCode ("TEST STRING");\r
32 \r
33                         Assert("Mixed Case != lower case", h1 == h2);\r
34                         Assert("Mixed Case != UPPER CASE", h1 == h3);\r
35 \r
36                         h1 = cih.GetHashCode ("one");\r
37                         h2 = cih.GetHashCode ("another");\r
38                         // Actually this is quite possible.\r
39                         Assert(h1 != h2);\r
40                 }\r
41                         \r
42         }\r
43 \r
44 }\r