Merge pull request #347 from JamesB7/master
[mono.git] / mcs / class / corlib / Test / System.Globalization / CultureInfoTest.cs
1 //
2 // System.Globalization.CultureInfo Test Cases
3 //
4 // Authors:
5 //      Gonzalo Paniagua Javier (gonzalo@ximian.com)
6 //
7 // (c) 2005 Novell, Inc. (http://www.novell.com)
8 //
9
10 using System;
11 using System.Globalization;
12 using System.IO;
13 using System.Runtime.Serialization.Formatters.Binary;
14 using System.Threading;
15
16 using NUnit.Framework;
17
18 namespace MonoTests.System.Globalization
19 {
20         [TestFixture]
21         public class CultureInfoTest
22         {
23                 CultureInfo old_culture;
24
25                 [SetUp]
26                 public void Setup ()
27                 {
28                         old_culture = Thread.CurrentThread.CurrentCulture;
29                 }
30
31                 [TearDown]
32                 public void TearDown ()
33                 {
34                         Thread.CurrentThread.CurrentCulture = old_culture;
35                 }
36
37                 [Test]
38                 public void Constructor0 ()
39                 {
40                         CultureInfo ci = new CultureInfo (2067);
41                         Assert.IsFalse (ci.IsReadOnly, "#1");
42                         Assert.AreEqual (2067, ci.LCID, "#2");
43                         Assert.AreEqual ("nl-BE", ci.Name, "#3");
44                         Assert.IsTrue (ci.UseUserOverride, "#4");
45                 }
46
47                 [Test]
48                 public void Constructor0_Identifier_Negative ()
49                 {
50                         try {
51                                 new CultureInfo (-1);
52                                 Assert.Fail ("#1");
53                         } catch (ArgumentOutOfRangeException ex) {
54                                 Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
55                                 Assert.IsNull (ex.InnerException, "#3");
56                                 Assert.IsNotNull (ex.Message, "#4");
57                                 Assert.IsNotNull (ex.ParamName, "#5");
58                                 Assert.AreEqual ("culture", ex.ParamName, "#6");
59                         }
60                 }
61
62                 [Test]
63                 public void Constructor1 ()
64                 {
65                         CultureInfo ci = new CultureInfo ("nl-BE");
66                         Assert.IsFalse (ci.IsReadOnly, "#1");
67                         Assert.AreEqual (2067, ci.LCID, "#2");
68                         Assert.AreEqual ("nl-BE", ci.Name, "#3");
69                         Assert.IsTrue (ci.UseUserOverride, "#4");
70                 }
71
72                 [Test]
73                 public void Constructor1_Name_Null ()
74                 {
75                         try {
76                                 new CultureInfo ((string) null);
77                                 Assert.Fail ("#1");
78                         } catch (ArgumentNullException ex) {
79                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
80                                 Assert.IsNull (ex.InnerException, "#3");
81                                 Assert.IsNotNull (ex.Message, "#4");
82                                 Assert.IsNotNull (ex.ParamName, "#5");
83                                 Assert.AreEqual ("name", ex.ParamName, "#6");
84                         }
85                 }
86
87                 [Test]
88                 public void Constructor2 ()
89                 {
90                         CultureInfo ci = new CultureInfo (2067, false);
91                         Assert.IsFalse (ci.IsReadOnly, "#A1");
92                         Assert.AreEqual (2067, ci.LCID, "#A2");
93                         Assert.AreEqual ("nl-BE", ci.Name, "#A3");
94                         Assert.IsFalse (ci.UseUserOverride, "#A4");
95
96                         ci = new CultureInfo (2067, true);
97                         Assert.IsFalse (ci.IsReadOnly, "#B1");
98                         Assert.AreEqual (2067, ci.LCID, "#B2");
99                         Assert.AreEqual ("nl-BE", ci.Name, "#B3");
100                         Assert.IsTrue (ci.UseUserOverride, "#B4");
101                 }
102
103                 [Test]
104                 public void Constructor2_Identifier_Negative ()
105                 {
106                         try {
107                                 new CultureInfo (-1, false);
108                                 Assert.Fail ("#1");
109                         } catch (ArgumentOutOfRangeException ex) {
110                                 Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
111                                 Assert.IsNull (ex.InnerException, "#3");
112                                 Assert.IsNotNull (ex.Message, "#4");
113                                 Assert.IsNotNull (ex.ParamName, "#5");
114                                 Assert.AreEqual ("culture", ex.ParamName, "#6");
115                         }
116                 }
117
118                 [Test]
119                 public void Constructor3 ()
120                 {
121                         CultureInfo ci = new CultureInfo ("nl-BE", false);
122                         Assert.IsFalse (ci.IsReadOnly, "#A1");
123                         Assert.AreEqual (2067, ci.LCID, "#A2");
124                         Assert.AreEqual ("nl-BE", ci.Name, "#A3");
125                         Assert.IsFalse (ci.UseUserOverride, "#A4");
126
127                         ci = new CultureInfo ("nl-BE", true);
128                         Assert.IsFalse (ci.IsReadOnly, "#B1");
129                         Assert.AreEqual (2067, ci.LCID, "#B2");
130                         Assert.AreEqual ("nl-BE", ci.Name, "#B3");
131                         Assert.IsTrue (ci.UseUserOverride, "#B4");
132                 }
133
134                 [Test]
135                 public void Constructor3_Name_Null ()
136                 {
137                         try {
138                                 new CultureInfo ((string) null, false);
139                                 Assert.Fail ("#1");
140                         } catch (ArgumentNullException ex) {
141                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
142                                 Assert.IsNull (ex.InnerException, "#3");
143                                 Assert.IsNotNull (ex.Message, "#4");
144                                 Assert.IsNotNull (ex.ParamName, "#5");
145                                 Assert.AreEqual ("name", ex.ParamName, "#6");
146                         }
147                 }
148
149                 [Test]
150                 public void CreateSpecificCulture ()
151                 {
152                         var ci = CultureInfo.CreateSpecificCulture ("en");
153                         Assert.AreEqual ("en-US", ci.Name, "#1");
154
155                         ci = CultureInfo.CreateSpecificCulture ("en-GB");
156                         Assert.AreEqual ("en-GB", ci.Name, "#2");
157
158                         ci = CultureInfo.CreateSpecificCulture ("en-----");
159                         Assert.AreEqual ("en-US", ci.Name, "#3");
160
161                         ci = CultureInfo.CreateSpecificCulture ("en-GB-");
162                         Assert.AreEqual ("en-US", ci.Name, "#4");
163
164                         ci = CultureInfo.CreateSpecificCulture ("");
165                         Assert.AreEqual (CultureInfo.InvariantCulture, ci, "#5");
166                 }
167
168                 [Test]
169                 public void CreateSpecificCulture_Invalid ()
170                 {
171                         try {
172                                 CultureInfo.CreateSpecificCulture ("uy32");
173                                 Assert.Fail ("#1");
174 #if NET_4_0
175                         } catch (CultureNotFoundException) {
176 #else
177                         } catch (ArgumentException) {
178 #endif
179                         }
180
181                         try {
182                                 CultureInfo.CreateSpecificCulture (null);
183                                 Assert.Fail ("#2");
184                         } catch (ArgumentNullException) {
185                                 // .NET throws NRE which is lame
186                         }
187                 }
188
189                 [Test]
190                 public void DateTimeFormat_Neutral_Culture ()
191                 {
192                         CultureInfo ci = new CultureInfo ("nl");
193                         try {
194                                 DateTimeFormatInfo dfi = ci.DateTimeFormat;
195 #if NET_4_0
196                                 Assert.IsNotNull (dfi, "#1");
197 #else
198                                 Assert.Fail ("#1:" + (dfi != null));
199 #endif
200                         } catch (NotSupportedException ex) {
201                                 Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
202                                 Assert.IsNull (ex.InnerException, "#3");
203                                 Assert.IsNotNull (ex.Message, "#4");
204                         }
205                 }
206
207                 [Test] // bug #72081
208                 public void GetAllCulturesInvariant ()
209                 {
210                         CultureInfo invariant = CultureInfo.InvariantCulture;
211                         CultureInfo [] infos = CultureInfo.GetCultures (CultureTypes.AllCultures);
212                         foreach (CultureInfo culture in infos) {
213                                 if (culture.Equals (invariant))
214                                         return;
215                         }
216
217                         Assert.Fail ("InvariantCulture not found in the array from GetCultures()");
218                 }
219
220                 [Test]
221 #if !NET_4_0
222                 [ExpectedException (typeof (NotSupportedException))]
223 #endif
224                 public void TrySetNeutralCultureNotInvariant ()
225                 {
226                         Thread.CurrentThread.CurrentCulture = new CultureInfo ("ar");
227                 }
228
229                 [Test]
230                 [Category ("TargetJvmNotWorking")] //OptionalCalendars not yet supported for TARGET_JVM.
231                 // make sure that all CultureInfo holds non-null calendars.
232                 public void OptionalCalendars ()
233                 {
234                         foreach (CultureInfo ci in CultureInfo.GetCultures (
235                                 CultureTypes.AllCultures))
236                                 Assert.IsNotNull (ci.OptionalCalendars, String.Format ("{0} {1}",
237                                         ci.LCID, ci.Name));
238                 }
239
240                 [Test] // bug #77347
241                 public void CloneNeutral ()
242                 {
243                         CultureInfo culture = new CultureInfo ("en");
244                         CultureInfo cultureClone = culture.Clone () as CultureInfo;
245                         Assert.IsTrue (culture.Equals (cultureClone));
246                 }
247
248                 [Test]
249                 public void IsNeutral ()
250                 {
251                         var ci = new CultureInfo (0x6C1A);
252                         Assert.IsTrue (ci.IsNeutralCulture, "#1");
253                         Assert.AreEqual ("srp", ci.ThreeLetterISOLanguageName, "#2");
254
255                         ci = new CultureInfo ("en-US");
256                         Assert.IsFalse (ci.IsNeutralCulture, "#1a");
257                         Assert.AreEqual ("eng", ci.ThreeLetterISOLanguageName, "#2a");
258                 }
259
260                 [Test] // bug #81930
261                 public void IsReadOnly ()
262                 {
263                         CultureInfo ci;
264
265                         ci = new CultureInfo ("en-US");
266                         Assert.IsFalse (ci.IsReadOnly, "#A1");
267                         Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#A2");
268                         Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#A3");
269                         ci.NumberFormat.NumberGroupSeparator = ",";
270                         ci.NumberFormat = new NumberFormatInfo ();
271                         ci.DateTimeFormat.DateSeparator = "/";
272                         ci.DateTimeFormat = new DateTimeFormatInfo ();
273                         Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#A4");
274                         Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#A5");
275
276                         ci = new CultureInfo (CultureInfo.InvariantCulture.LCID);
277                         Assert.IsFalse (ci.IsReadOnly, "#B1");
278                         Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#B2");
279                         Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#B3");
280                         ci.NumberFormat.NumberGroupSeparator = ",";
281                         ci.NumberFormat = new NumberFormatInfo ();
282                         ci.DateTimeFormat.DateSeparator = "/";
283                         ci.DateTimeFormat = new DateTimeFormatInfo ();
284                         Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#B4");
285                         Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#B5");
286
287                         ci = CultureInfo.CurrentCulture;
288                         Assert.IsTrue (ci.IsReadOnly, "#C1:" + ci.DisplayName);
289                         Assert.IsTrue (ci.NumberFormat.IsReadOnly, "#C2");
290                         Assert.IsTrue (ci.DateTimeFormat.IsReadOnly, "#C3");
291                         try {
292                                 ci.NumberFormat.NumberGroupSeparator = ",";
293                                 Assert.Fail ("#C4");
294                         } catch (InvalidOperationException ex) {
295                                 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C5");
296                                 Assert.IsNull (ex.InnerException, "#C6");
297                                 Assert.IsNotNull (ex.Message, "#C7");
298                         }
299
300                         ci = CultureInfo.CurrentUICulture;
301                         Assert.IsTrue (ci.IsReadOnly, "#D1");
302                         Assert.IsTrue (ci.NumberFormat.IsReadOnly, "#D2");
303                         Assert.IsTrue (ci.DateTimeFormat.IsReadOnly, "#D3");
304                         try {
305                                 ci.NumberFormat.NumberGroupSeparator = ",";
306                                 Assert.Fail ("#D4");
307                         } catch (InvalidOperationException ex) {
308                                 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D5");
309                                 Assert.IsNull (ex.InnerException, "#D6");
310                                 Assert.IsNotNull (ex.Message, "#D7");
311                         }
312
313                         ci = CultureInfo.InvariantCulture;
314                         Assert.IsTrue (ci.IsReadOnly, "#F1");
315                         Assert.IsTrue (ci.NumberFormat.IsReadOnly, "#F2");
316                         Assert.IsTrue (ci.DateTimeFormat.IsReadOnly, "#F3");
317                         try {
318                                 ci.NumberFormat.NumberGroupSeparator = ",";
319                                 Assert.Fail ("#F4");
320                         } catch (InvalidOperationException ex) {
321                                 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F5");
322                                 Assert.IsNull (ex.InnerException, "#F6");
323                                 Assert.IsNotNull (ex.Message, "#F7");
324                         }
325
326                         ci = new CultureInfo (string.Empty);
327                         Assert.IsFalse (ci.IsReadOnly, "#G1");
328                         Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#G2");
329                         Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#G3");
330                         ci.NumberFormat.NumberGroupSeparator = ",";
331                         ci.NumberFormat = new NumberFormatInfo ();
332                         ci.DateTimeFormat.DateSeparator = "/";
333                         ci.DateTimeFormat = new DateTimeFormatInfo ();
334                         Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#G4");
335                         Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#G5");
336                 }
337
338                 [Test]
339                 public void IsReadOnly_GetCultures ()
340                 {
341                         foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.AllCultures)) {
342                                 string cultureMsg = String.Format ("{0} {1}", ci.LCID, ci.Name);
343                                 Assert.IsFalse (ci.IsReadOnly, "#1:" + cultureMsg);
344                                 if (ci.IsNeutralCulture)
345                                         continue;
346                                 Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#2:" + cultureMsg);
347                                 Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#3:" + cultureMsg);
348                         }
349                 }
350
351                 [Test]
352                 [Category ("NotWorking")]
353                 public void IsReadOnly_InstalledUICulture ()
354                 {
355                         CultureInfo ci = CultureInfo.InstalledUICulture;
356                         Assert.IsTrue (ci.IsReadOnly, "#1");
357                         Assert.IsTrue (ci.NumberFormat.IsReadOnly, "#2");
358                         Assert.IsTrue (ci.DateTimeFormat.IsReadOnly, "#3");
359                         try {
360                                 ci.NumberFormat.NumberGroupSeparator = ",";
361                                 Assert.Fail ("#4");
362                         } catch (InvalidOperationException ex) {
363                                 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#5");
364                                 Assert.IsNull (ex.InnerException, "#6");
365                                 Assert.IsNotNull (ex.Message, "#7");
366                         }
367                 }
368
369                 [Test] // bug #69652
370                 public void Norwegian ()
371                 {
372                         new CultureInfo ("no");
373                         new CultureInfo ("nb-NO");
374                         new CultureInfo ("nn-NO");
375                 }
376
377                 [Test]
378                 public void NumberFormat_Neutral_Culture ()
379                 {
380                         CultureInfo ci = new CultureInfo ("nl");
381                         try {
382                                 NumberFormatInfo nfi = ci.NumberFormat;
383 #if NET_4_0
384                                 Assert.IsNotNull (nfi, "#1");
385 #else
386                                 Assert.Fail ("#1:" + (nfi != null));
387 #endif
388                         } catch (NotSupportedException ex) {
389                                 Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
390                                 Assert.IsNull (ex.InnerException, "#3");
391                                 Assert.IsNotNull (ex.Message, "#4");
392                         }
393                 }
394
395                 [Test]
396                 [Category ("NotDotNet")] // On MS, the NumberFormatInfo of the CultureInfo matching the current locale is not read-only
397                 public void GetCultureInfo_Identifier ()
398                 {
399                         foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.AllCultures)) {
400                                 string cultureMsg = String.Format ("{0} {1}", ci.LCID, ci.Name);
401                                 CultureInfo culture = CultureInfo.GetCultureInfo (ci.LCID);
402                                 Assert.IsTrue (culture.IsReadOnly, "#1:" + cultureMsg);
403                                 if (culture.IsNeutralCulture)
404                                         continue;
405                                 Assert.IsTrue (culture.NumberFormat.IsReadOnly, "#2:" + cultureMsg);
406                                 Assert.IsTrue (culture.DateTimeFormat.IsReadOnly, "#3:" + cultureMsg);
407                         }
408                 }
409
410                 [Test]
411                 public void GetCultureInfo_Identifier_Negative ()
412                 {
413                         try {
414                                 CultureInfo.GetCultureInfo (-1);
415                                 Assert.Fail ("#1");
416                         } catch (ArgumentOutOfRangeException ex) {
417                                 Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
418                                 Assert.IsNull (ex.InnerException, "#3");
419                                 Assert.IsNotNull (ex.Message, "#4");
420                                 Assert.IsNotNull (ex.ParamName, "#5");
421                                 Assert.AreEqual ("culture", ex.ParamName, "#6");
422                         }
423                 }
424
425                 [Test]
426                 public void GetCultureInfo_Identifier_NotSupported ()
427                 {
428                         try {
429                                 CultureInfo.GetCultureInfo (666);
430                                 Assert.Fail ("#1");
431                         } catch (ArgumentException ex) {
432 #if NET_4_0
433                                 Assert.AreEqual (typeof (CultureNotFoundException), ex.GetType (), "#2");
434 #else
435                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
436 #endif
437                                 Assert.IsNull (ex.InnerException, "#3");
438                                 Assert.IsNotNull (ex.Message, "#4");
439                                 Assert.IsNotNull (ex.ParamName, "#5");
440                                 Assert.AreEqual ("culture", ex.ParamName, "#6");
441                         }
442                 }
443
444                 [Test]
445                 [Category ("NotDotNet")] // On MS, the NumberFormatInfo of the CultureInfo matching the current locale is not read-only
446                 public void GetCultureInfo_Name ()
447                 {
448                         foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.AllCultures)) {
449                                 string cultureMsg = String.Format ("{0} {1}", ci.LCID, ci.Name);
450                                 CultureInfo culture = CultureInfo.GetCultureInfo (ci.Name);
451                                 Assert.IsTrue (culture.IsReadOnly, "#1:" + cultureMsg);
452                                 if (culture.IsNeutralCulture)
453                                         continue;
454                                 Assert.IsTrue (culture.NumberFormat.IsReadOnly, "#2:" + cultureMsg);
455                                 Assert.IsTrue (culture.DateTimeFormat.IsReadOnly, "#3:" + cultureMsg);
456                         }
457                 }
458
459                 [Test]
460                 public void GetCultureInfo_Name_NotSupported ()
461                 {
462                         try {
463                                 CultureInfo.GetCultureInfo ("666");
464                                 Assert.Fail ("#1");
465                         } catch (ArgumentException ex) {
466 #if NET_4_0
467                                 Assert.AreEqual (typeof (CultureNotFoundException), ex.GetType (), "#2");
468 #else
469                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
470 #endif
471                                 Assert.IsNull (ex.InnerException, "#3");
472                                 Assert.IsNotNull (ex.Message, "#4");
473                                 Assert.IsNotNull (ex.ParamName, "#5");
474                                 Assert.AreEqual ("name", ex.ParamName, "#6");
475                         }
476                 }
477
478                 [Test]
479                 public void GetCultureInfo_Name_Null ()
480                 {
481                         try {
482                                 CultureInfo.GetCultureInfo ((string) null);
483                                 Assert.Fail ("#1");
484                         } catch (ArgumentNullException ex) {
485                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
486                                 Assert.IsNull (ex.InnerException, "#3");
487                                 Assert.IsNotNull (ex.Message, "#4");
488                                 Assert.IsNotNull (ex.ParamName, "#5");
489                                 Assert.AreEqual ("name", ex.ParamName, "#6");
490                         }
491                 }
492
493                 [Test]
494                 public void UseUserOverride_CurrentCulture ()
495                 {
496                         CultureInfo ci = CultureInfo.CurrentCulture;
497                         bool expected = (ci.LCID != CultureInfo.InvariantCulture.LCID);
498                         Assert.AreEqual (expected, ci.UseUserOverride, "#1");
499
500                         ci = (CultureInfo) ci.Clone ();
501                         Assert.AreEqual (expected, ci.UseUserOverride, "#2");
502                 }
503
504                 [Test]
505                 public void UseUserOverride_CurrentUICulture ()
506                 {
507                         CultureInfo ci = CultureInfo.CurrentCulture;
508                         bool expected = (ci.LCID != CultureInfo.InvariantCulture.LCID);
509                         Assert.AreEqual (expected, ci.UseUserOverride, "#1");
510
511                         ci = (CultureInfo) ci.Clone ();
512                         Assert.AreEqual (expected, ci.UseUserOverride, "#2");
513                 }
514
515                 [Test]
516                 public void UseUserOverride_GetCultureInfo ()
517                 {
518                         CultureInfo culture;
519
520                         foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.AllCultures)) {
521                                 string cultureMsg = String.Format ("{0} {1}", ci.LCID, ci.Name);
522                                 culture = CultureInfo.GetCultureInfo (ci.Name);
523                                 Assert.IsFalse (culture.UseUserOverride, "#1: " + cultureMsg);
524                                 culture = CultureInfo.GetCultureInfo (ci.LCID);
525                                 Assert.IsFalse (culture.UseUserOverride, "#2: " + cultureMsg);
526                         }
527                 }
528
529                 [Test]
530                 public void UseUserOverride_GetCultures ()
531                 {
532                         foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.AllCultures)) {
533                                 string cultureMsg = String.Format ("{0} {1}", ci.LCID, ci.Name);
534                                 if (ci.LCID == CultureInfo.InvariantCulture.LCID)
535                                         Assert.IsFalse (ci.UseUserOverride, cultureMsg);
536                                 else
537                                         Assert.IsTrue (ci.UseUserOverride, cultureMsg);
538                         }
539                 }
540
541                 [Test]
542                 public void UseUserOverride_InvariantCulture ()
543                 {
544                         CultureInfo ci = CultureInfo.InvariantCulture;
545                         Assert.IsFalse (ci.UseUserOverride, "#21");
546
547                         ci = (CultureInfo) ci.Clone ();
548                         Assert.IsFalse (ci.UseUserOverride, "#2");
549                 }
550
551                 [Test]
552                 public void Bug402128 ()
553                 {
554                         var culture = new CultureInfo ("en-US");
555                         var ms = new MemoryStream ();
556                         var formatter = new BinaryFormatter ();
557                         formatter.Serialize (ms, culture);
558                         ms.Seek (0, SeekOrigin.Begin);
559                         var deserializedCulture = (CultureInfo) formatter.Deserialize (ms);
560                 }
561
562                 [Test]
563                 public void ZhHant ()
564                 {
565                         Assert.AreEqual (31748, new CultureInfo ("zh-Hant").LCID);
566                         Assert.AreEqual (31748, CultureInfo.GetCultureInfo ("zh-Hant").LCID);
567                 }
568         }
569 }