2 // CultureTest.cs: Test cases for culture-invariant string convertions
5 // Robert Jordan <robertj@gmx.net>
9 using System.Collections;
10 using System.Globalization;
13 using System.Resources;
14 using System.Threading;
15 using NUnit.Framework;
17 namespace MonoTests.System.Resources
20 public class CultureTest
22 string fileName = Path.GetTempFileName ();
25 public void TestWriter ()
27 Thread.CurrentThread.CurrentCulture =
28 Thread.CurrentThread.CurrentUICulture = new CultureInfo ("de-DE");
30 ResXResourceWriter w = new ResXResourceWriter (fileName);
31 w.AddResource ("point", new Point (42, 43));
37 public void TestReader ()
39 Thread.CurrentThread.CurrentCulture =
40 Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
43 ResXResourceReader r = new ResXResourceReader (fileName);
44 IDictionaryEnumerator e = r.GetEnumerator ();
45 while (e.MoveNext ()) {
46 if ((string)e.Key == "point") {
47 Assert.AreEqual (typeof (Point), e.Value.GetType (), "#1");
48 Point p = (Point) e.Value;
49 Assert.AreEqual (42, p.X, "#2");
50 Assert.AreEqual (43, p.Y, "#3");
55 File.Delete (fileName);
56 Assert.AreEqual (1, count, "#100");