update locale formatter test expectations to reflect subtle changes in the tested locales introduced by .NET 4.0
This commit is contained in:
@@ -24,13 +24,13 @@ using NUnit.Framework;
|
||||
|
||||
namespace Spring.Globalization.Formatters
|
||||
{
|
||||
/// <summary>
|
||||
/// Unit tests for CurrencyFormatter class.
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Unit tests for CurrencyFormatter class.
|
||||
/// </summary>
|
||||
/// <author>Aleksandar Seovic</author>
|
||||
[TestFixture]
|
||||
public class CurrencyFormatterTests
|
||||
{
|
||||
{
|
||||
[Test]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void FormatNullValue()
|
||||
@@ -65,16 +65,29 @@ namespace Spring.Globalization.Formatters
|
||||
Assert.AreEqual("($1,234.56)", fmt.Format(-1234.56));
|
||||
|
||||
fmt = new CurrencyFormatter(CultureInfoUtils.SerbianLatinCultureName);
|
||||
#if NET_4_0
|
||||
Assert.AreEqual("1.234,00 din.", fmt.Format(1234));
|
||||
Assert.AreEqual("1.234,56 din.", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1.234,00 din.", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1.234,56 din.", fmt.Format(-1234.56));
|
||||
#else
|
||||
Assert.AreEqual("1.234,00 Din.", fmt.Format(1234));
|
||||
Assert.AreEqual("1.234,56 Din.", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1.234,00 Din.", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1.234,56 Din.", fmt.Format(-1234.56));
|
||||
|
||||
#endif
|
||||
fmt = new CurrencyFormatter(CultureInfoUtils.SerbianCyrillicCultureName);
|
||||
#if NET_4_0
|
||||
Assert.AreEqual("1.234,00 дин.", fmt.Format(1234));
|
||||
Assert.AreEqual("1.234,56 дин.", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1.234,00 дин.", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1.234,56 дин.", fmt.Format(-1234.56));
|
||||
#else
|
||||
Assert.AreEqual("1.234,00 Дин.", fmt.Format(1234));
|
||||
Assert.AreEqual("1.234,56 Дин.", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1.234,00 Дин.", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1.234,56 Дин.", fmt.Format(-1234.56));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -87,16 +100,30 @@ namespace Spring.Globalization.Formatters
|
||||
Assert.AreEqual(-1234.56, fmt.Parse("($1,234.56)"));
|
||||
|
||||
fmt = new CurrencyFormatter(CultureInfoUtils.SerbianLatinCultureName);
|
||||
#if NET_4_0
|
||||
Assert.AreEqual(1234, fmt.Parse("1.234,00 din."));
|
||||
Assert.AreEqual(1234.56, fmt.Parse("1.234,56 din."));
|
||||
Assert.AreEqual(-1234, fmt.Parse("-1.234,00 din."));
|
||||
Assert.AreEqual(-1234.56, fmt.Parse("-1.234,56 din."));
|
||||
#else
|
||||
Assert.AreEqual(1234, fmt.Parse("1.234,00 Din."));
|
||||
Assert.AreEqual(1234.56, fmt.Parse("1.234,56 Din."));
|
||||
Assert.AreEqual(-1234, fmt.Parse("-1.234,00 Din."));
|
||||
Assert.AreEqual(-1234.56, fmt.Parse("-1.234,56 Din."));
|
||||
#endif
|
||||
|
||||
fmt = new CurrencyFormatter(CultureInfoUtils.SerbianCyrillicCultureName);
|
||||
#if NET_4_0
|
||||
Assert.AreEqual(1234, fmt.Parse("1.234,00 дин."));
|
||||
Assert.AreEqual(1234.56, fmt.Parse("1.234,56 дин."));
|
||||
Assert.AreEqual(-1234, fmt.Parse("-1.234,00 дин."));
|
||||
Assert.AreEqual(-1234.56, fmt.Parse("-1.234,56 дин."));
|
||||
#else
|
||||
Assert.AreEqual(1234, fmt.Parse("1.234,00 Дин."));
|
||||
Assert.AreEqual(1234.56, fmt.Parse("1.234,56 Дин."));
|
||||
Assert.AreEqual(-1234, fmt.Parse("-1.234,00 Дин."));
|
||||
Assert.AreEqual(-1234.56, fmt.Parse("-1.234,56 Дин."));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -119,12 +146,20 @@ namespace Spring.Globalization.Formatters
|
||||
Assert.AreEqual("-1.234,56 din", fmt.Format(-1234.56));
|
||||
|
||||
fmt = new CurrencyFormatter(CultureInfoUtils.SerbianCyrillicCultureName);
|
||||
fmt.GroupSizes = new int[] {1, 2};
|
||||
fmt.GroupSizes = new int[] { 1, 2 };
|
||||
fmt.GroupSeparator = "'";
|
||||
|
||||
#if NET_4_0
|
||||
Assert.AreEqual("1'23'4,00 дин.", fmt.Format(1234));
|
||||
Assert.AreEqual("1'23'4,56 дин.", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1'23'4,00 дин.", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1'23'4,56 дин.", fmt.Format(-1234.56));
|
||||
#else
|
||||
Assert.AreEqual("1'23'4,00 Дин.", fmt.Format(1234));
|
||||
Assert.AreEqual("1'23'4,56 Дин.", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1'23'4,00 Дин.", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1'23'4,56 Дин.", fmt.Format(-1234.56));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -147,12 +182,19 @@ namespace Spring.Globalization.Formatters
|
||||
Assert.AreEqual(-1234.56, fmt.Parse("-1.234,56 din"));
|
||||
|
||||
fmt = new CurrencyFormatter(CultureInfoUtils.SerbianCyrillicCultureName);
|
||||
fmt.GroupSizes = new int[] {1, 2};
|
||||
fmt.GroupSizes = new int[] { 1, 2 };
|
||||
fmt.GroupSeparator = "'";
|
||||
#if NET_4_0
|
||||
Assert.AreEqual(1234, fmt.Parse("1'23'4,00 дин."));
|
||||
Assert.AreEqual(1234.56, fmt.Parse("1'23'4,56 дин."));
|
||||
Assert.AreEqual(-1234, fmt.Parse("-1'23'4,00 дин."));
|
||||
Assert.AreEqual(-1234.56, fmt.Parse("-1'23'4,56 дин."));
|
||||
#else
|
||||
Assert.AreEqual(1234, fmt.Parse("1'23'4,00 Дин."));
|
||||
Assert.AreEqual(1234.56, fmt.Parse("1'23'4,56 Дин."));
|
||||
Assert.AreEqual(-1234, fmt.Parse("-1'23'4,00 Дин."));
|
||||
Assert.AreEqual(-1234.56, fmt.Parse("-1'23'4,56 Дин."));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -67,12 +67,21 @@ namespace Spring.Globalization.Formatters
|
||||
Assert.AreEqual("24-Aug-1974", fmt.Format(new DateTime(1974, 8, 24)));
|
||||
|
||||
fmt = new DateTimeFormatter("D", CultureInfoUtils.SerbianLatinCultureName);
|
||||
#if NET_4_0
|
||||
Assert.AreEqual("14. avgust 2004.", fmt.Format(new DateTime(2004, 8, 14)));
|
||||
Assert.AreEqual("24. avgust 1974.", fmt.Format(new DateTime(1974, 8, 24)));
|
||||
#else
|
||||
Assert.AreEqual("14. avgust 2004", fmt.Format(new DateTime(2004, 8, 14)));
|
||||
Assert.AreEqual("24. avgust 1974", fmt.Format(new DateTime(1974, 8, 24)));
|
||||
|
||||
#endif
|
||||
fmt = new DateTimeFormatter("dd-MMM-yyyy", CultureInfoUtils.SerbianCyrillicCultureName);
|
||||
#if NET_4_0
|
||||
Assert.AreEqual("14-авг.-2004", fmt.Format(new DateTime(2004, 8, 14)));
|
||||
Assert.AreEqual("24-авг.-1974", fmt.Format(new DateTime(1974, 8, 24)));
|
||||
#else
|
||||
Assert.AreEqual("14-авг-2004", fmt.Format(new DateTime(2004, 8, 14)));
|
||||
Assert.AreEqual("24-авг-1974", fmt.Format(new DateTime(1974, 8, 24)));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -87,12 +96,22 @@ namespace Spring.Globalization.Formatters
|
||||
Assert.AreEqual(new DateTime(1974, 8, 24), fmt.Parse("24-Aug-1974"));
|
||||
|
||||
fmt = new DateTimeFormatter("D", CultureInfoUtils.SerbianLatinCultureName);
|
||||
#if NET_4_0
|
||||
Assert.AreEqual(new DateTime(2004, 8, 14), fmt.Parse("14. avgust 2004."));
|
||||
Assert.AreEqual(new DateTime(1974, 8, 24), fmt.Parse("24. avgust 1974."));
|
||||
#else
|
||||
Assert.AreEqual(new DateTime(2004, 8, 14), fmt.Parse("14. avgust 2004"));
|
||||
Assert.AreEqual(new DateTime(1974, 8, 24), fmt.Parse("24. avgust 1974"));
|
||||
#endif
|
||||
|
||||
fmt = new DateTimeFormatter("dd-MMM-yyyy", CultureInfoUtils.SerbianCyrillicCultureName);
|
||||
#if NET_4_0
|
||||
Assert.AreEqual(new DateTime(2004, 8, 14), fmt.Parse("14-авг.-2004"));
|
||||
Assert.AreEqual(new DateTime(1974, 8, 24), fmt.Parse("24-авг.-1974"));
|
||||
#else
|
||||
Assert.AreEqual(new DateTime(2004, 8, 14), fmt.Parse("14-авг-2004"));
|
||||
Assert.AreEqual(new DateTime(1974, 8, 24), fmt.Parse("24-авг-1974"));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user