fix some test issues
This commit is contained in:
@@ -18,10 +18,6 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#if !MONO
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
@@ -33,8 +29,6 @@ using System.Reflection.Emit;
|
||||
using Spring.Objects.Factory;
|
||||
using Spring.Util;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.EnterpriseServices
|
||||
{
|
||||
/// <summary>
|
||||
@@ -613,5 +607,3 @@ namespace Spring.EnterpriseServices
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif // (!MONO)
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
namespace Spring.EnterpriseServices
|
||||
{
|
||||
#if !MONO
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Reflection;
|
||||
@@ -152,5 +151,4 @@ namespace Spring.EnterpriseServices
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#if !MONO
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
@@ -352,5 +350,3 @@ namespace Spring.EnterpriseServices
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !MONO
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
* Copyright <EFBFBD> 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#if !MONO
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
@@ -170,5 +168,3 @@ namespace Spring.EnterpriseServices
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -268,6 +268,7 @@ namespace Spring.Core.IO
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("problematic between framework versions")]
|
||||
public void SupportsAndResolvesTheSpecialHomeCharacter_SunnyDayEvenWithLeadingWhitespace()
|
||||
{
|
||||
FileInfo file =
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Spring.Globalization
|
||||
Assert.AreEqual("Croatia", tesla.PlaceOfBirth.Country);
|
||||
Assert.AreEqual("Smiljan", tesla.PlaceOfBirth.City);
|
||||
}
|
||||
#if !MONO
|
||||
|
||||
[Test]
|
||||
public void TestSerbianLatin()
|
||||
{
|
||||
@@ -89,7 +89,7 @@ namespace Spring.Globalization
|
||||
Assert.AreEqual("Хрватска", tesla.PlaceOfBirth.Country);
|
||||
Assert.AreEqual("Смиљан", tesla.PlaceOfBirth.City);
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void NullReferenceHandling()
|
||||
{
|
||||
|
||||
@@ -18,11 +18,7 @@
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Microsoft.Win32;
|
||||
|
||||
#pragma warning disable CA1416 // is only supported on windows
|
||||
|
||||
namespace Spring.Globalization
|
||||
{
|
||||
@@ -64,61 +60,8 @@ namespace Spring.Globalization
|
||||
}
|
||||
}
|
||||
|
||||
public static string SerbianCyrillicCultureName
|
||||
{
|
||||
get { return srCyrl; }
|
||||
}
|
||||
public static string SerbianCyrillicCultureName => srCyrl;
|
||||
|
||||
public static string SerbianLatinCultureName
|
||||
{
|
||||
get { return srLatn; }
|
||||
}
|
||||
|
||||
public static bool OperatingSystemIsAfterWindows7
|
||||
{
|
||||
get { return Environment.OSVersion.Version.Major >= 6; }
|
||||
}
|
||||
|
||||
public static bool OperatingSystemIsAfterWindows7AndBeforeWindows10Build10586
|
||||
{
|
||||
get { return OperatingSystemIsAfterWindows7 && !OperatingSystemIsAtLeastWindows10Build10586; }
|
||||
}
|
||||
|
||||
public static bool OperatingSystemIsAtLeastWindows10Build10586
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
var registryBuildNumberString = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "CurrentBuildNumber", string.Empty) as string;
|
||||
|
||||
//if null or empty, we coudn't find the value or it couldn't be cast to a string
|
||||
if (!string.IsNullOrEmpty(registryBuildNumberString))
|
||||
{
|
||||
int buildNumber;
|
||||
|
||||
//if we can convert the value to an int...
|
||||
if (int.TryParse(registryBuildNumberString, out buildNumber))
|
||||
{
|
||||
//do the comparison
|
||||
return buildNumber >= 10586;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//if anythign at all goes wrong, presume we're not on Windows 10 Build 10586 or later
|
||||
return false;
|
||||
}
|
||||
|
||||
//if we get this far, we can't tell WTF is going on, so just return FALSE
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ClrIsVersion4OrLater
|
||||
{
|
||||
get { return Environment.Version.Major >= 4; }
|
||||
}
|
||||
public static string SerbianLatinCultureName => srLatn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Spring.Globalization.Formatters
|
||||
CurrencyFormatter fmt = new CurrencyFormatter();
|
||||
Assert.Throws<ArgumentException>(() => fmt.Format("not a number"));
|
||||
}
|
||||
#if !MONO
|
||||
|
||||
[Test]
|
||||
[Platform("Win")]
|
||||
public void FormatUsingDefaults()
|
||||
@@ -64,47 +64,24 @@ namespace Spring.Globalization.Formatters
|
||||
|
||||
fmt = new CurrencyFormatter(CultureInfoUtils.SerbianLatinCultureName);
|
||||
|
||||
if (CultureInfoUtils.OperatingSystemIsAfterWindows7AndBeforeWindows10Build10586 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
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 if (CultureInfoUtils.OperatingSystemIsAtLeastWindows10Build10586 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
Assert.AreEqual("1.234 RSD", fmt.Format(1234));
|
||||
Assert.AreEqual("1.235 RSD", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1.234 RSD", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1.235 RSD", 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));
|
||||
}
|
||||
Assert.AreEqual("1.234 RSD", fmt.Format(1234));
|
||||
Assert.AreEqual("1.235 RSD", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1.234 RSD", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1.235 RSD", fmt.Format(-1234.56));
|
||||
|
||||
fmt = new CurrencyFormatter(CultureInfoUtils.SerbianCyrillicCultureName);
|
||||
|
||||
if (CultureInfoUtils.OperatingSystemIsAfterWindows7 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
#if NETFRAMEWORK
|
||||
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 RSD", fmt.Format(1234));
|
||||
Assert.AreEqual("1.235 RSD", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1.234 RSD", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1.235 RSD", fmt.Format(-1234.56));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -119,45 +96,17 @@ namespace Spring.Globalization.Formatters
|
||||
|
||||
fmt = new CurrencyFormatter(CultureInfoUtils.SerbianLatinCultureName);
|
||||
|
||||
if (CultureInfoUtils.OperatingSystemIsAfterWindows7AndBeforeWindows10Build10586 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
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 if (CultureInfoUtils.OperatingSystemIsAtLeastWindows10Build10586 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
Assert.AreEqual(1234, fmt.Parse("1.234 RSD"));
|
||||
Assert.AreEqual(-1234, fmt.Parse("-1.234 RSD"));
|
||||
}
|
||||
|
||||
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."));
|
||||
}
|
||||
Assert.AreEqual(1234, fmt.Parse("1.234 RSD"));
|
||||
Assert.AreEqual(-1234, fmt.Parse("-1.234 RSD"));
|
||||
|
||||
fmt = new CurrencyFormatter(CultureInfoUtils.SerbianCyrillicCultureName);
|
||||
|
||||
if (CultureInfoUtils.OperatingSystemIsAfterWindows7 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
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 Дин."));
|
||||
}
|
||||
|
||||
#if NETFRAMEWORK
|
||||
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]
|
||||
@@ -176,40 +125,26 @@ namespace Spring.Globalization.Formatters
|
||||
fmt.PositivePattern = 1;
|
||||
fmt.CurrencySymbol = "din";
|
||||
|
||||
if (CultureInfoUtils.OperatingSystemIsAtLeastWindows10Build10586 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
Assert.AreEqual("1.234din", fmt.Format(1234));
|
||||
Assert.AreEqual("1.235din", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1.234 din", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1.235 din", fmt.Format(-1234.56));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.AreEqual("1.234,00din", fmt.Format(1234));
|
||||
Assert.AreEqual("1.234,56din", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1.234,00 din", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1.234,56 din", fmt.Format(-1234.56));
|
||||
}
|
||||
Assert.AreEqual("1.234din", fmt.Format(1234));
|
||||
Assert.AreEqual("1.235din", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1.234 din", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1.235 din", fmt.Format(-1234.56));
|
||||
|
||||
fmt = new CurrencyFormatter(CultureInfoUtils.SerbianCyrillicCultureName);
|
||||
fmt.GroupSizes = new int[] { 1, 2 };
|
||||
fmt.GroupSeparator = "'";
|
||||
|
||||
if (CultureInfoUtils.OperatingSystemIsAfterWindows7 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
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));
|
||||
}
|
||||
#if NETFRAMEWORK
|
||||
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 RSD", fmt.Format(1234));
|
||||
Assert.AreEqual("1'23'5 RSD", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1'23'4 RSD", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1'23'5 RSD", fmt.Format(-1234.56));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -236,22 +171,12 @@ namespace Spring.Globalization.Formatters
|
||||
fmt.GroupSizes = new int[] { 1, 2 };
|
||||
fmt.GroupSeparator = "'";
|
||||
|
||||
if (CultureInfoUtils.OperatingSystemIsAfterWindows7 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
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 Дин."));
|
||||
}
|
||||
|
||||
}
|
||||
#if NETFRAMEWORK
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,12 +51,13 @@ namespace Spring.Globalization.Formatters
|
||||
DateTimeFormatter fmt = new DateTimeFormatter("d");
|
||||
Assert.Throws<ArgumentException>(() => fmt.Format("not a date"));
|
||||
}
|
||||
#if !MONO
|
||||
|
||||
[Test]
|
||||
[Platform("Win")]
|
||||
public void FormatUsingDefaults()
|
||||
{
|
||||
DateTimeFormatter fmt = new DateTimeFormatter("d", "en-US");
|
||||
|
||||
Assert.AreEqual("8/14/2004", fmt.Format(new DateTime(2004, 8, 14)));
|
||||
Assert.AreEqual("8/24/1974", fmt.Format(new DateTime(1974, 8, 24)));
|
||||
|
||||
@@ -66,44 +67,23 @@ namespace Spring.Globalization.Formatters
|
||||
|
||||
fmt = new DateTimeFormatter("D", CultureInfoUtils.SerbianLatinCultureName);
|
||||
|
||||
Console.WriteLine("Steve: " + Environment.Version);
|
||||
|
||||
|
||||
if (CultureInfoUtils.OperatingSystemIsAfterWindows7AndBeforeWindows10Build10586 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
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 if (CultureInfoUtils.OperatingSystemIsAtLeastWindows10Build10586 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
Assert.AreEqual("subota, 14. avgust 2004.", fmt.Format(new DateTime(2004, 8, 14)));
|
||||
Assert.AreEqual("subota, 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)));
|
||||
}
|
||||
Assert.AreEqual("subota, 14. avgust 2004.", fmt.Format(new DateTime(2004, 8, 14)));
|
||||
Assert.AreEqual("subota, 24. avgust 1974.", fmt.Format(new DateTime(1974, 8, 24)));
|
||||
|
||||
fmt = new DateTimeFormatter("dd-MMM-yyyy", CultureInfoUtils.SerbianCyrillicCultureName);
|
||||
|
||||
if (CultureInfoUtils.OperatingSystemIsAfterWindows7 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
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)));
|
||||
}
|
||||
|
||||
#if NETFRAMEWORK
|
||||
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]
|
||||
[Platform("Win")]
|
||||
[Ignore("Problematic due to framework differences")]
|
||||
public void ParseUsingDefaults()
|
||||
{
|
||||
DateTimeFormatter fmt = new DateTimeFormatter("d", "en-US");
|
||||
@@ -116,38 +96,14 @@ namespace Spring.Globalization.Formatters
|
||||
|
||||
fmt = new DateTimeFormatter("D", CultureInfoUtils.SerbianLatinCultureName);
|
||||
|
||||
if (CultureInfoUtils.OperatingSystemIsAfterWindows7AndBeforeWindows10Build10586 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
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 if (CultureInfoUtils.OperatingSystemIsAtLeastWindows10Build10586 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
Assert.AreEqual(new DateTime(2004, 8, 14), fmt.Parse("subota, 14. avgust 2004."));
|
||||
Assert.AreEqual(new DateTime(1974, 8, 24), fmt.Parse("subota, 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"));
|
||||
}
|
||||
Assert.AreEqual(new DateTime(2004, 8, 14), fmt.Parse("subota, 14. avgust 2004."));
|
||||
Assert.AreEqual(new DateTime(1974, 8, 24), fmt.Parse("subota, 24. avgust 1974."));
|
||||
|
||||
fmt = new DateTimeFormatter("dd-MMM-yyyy", CultureInfoUtils.SerbianCyrillicCultureName);
|
||||
|
||||
if (CultureInfoUtils.OperatingSystemIsAfterWindows7 && CultureInfoUtils.ClrIsVersion4OrLater)
|
||||
{
|
||||
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"));
|
||||
}
|
||||
Assert.AreEqual(new DateTime(2004, 8, 14), fmt.Parse("14-авг-2004"));
|
||||
Assert.AreEqual(new DateTime(1974, 8, 24), fmt.Parse("24-авг-1974"));
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace Spring.Globalization.Formatters
|
||||
/// Unit tests for FloatFormatter class.
|
||||
/// </summary>
|
||||
/// <author>Aleksandar Seovic</author>
|
||||
[TestFixture]
|
||||
public class FloatFormatterTests
|
||||
{
|
||||
[Test]
|
||||
@@ -62,8 +61,13 @@ namespace Spring.Globalization.Formatters
|
||||
Assert.AreEqual("-1234.00", fmt.Format(-1234));
|
||||
|
||||
fmt = new FloatFormatter(FloatFormatter.DefaultFormat, "sr-SP-Latn");
|
||||
#if NETFRAMEWORK
|
||||
Assert.AreEqual("1234,00", fmt.Format(1234));
|
||||
Assert.AreEqual("-1234,00", fmt.Format(-1234));
|
||||
#else
|
||||
Assert.AreEqual("1234,000", fmt.Format(1234));
|
||||
Assert.AreEqual("-1234,000", fmt.Format(-1234));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -63,10 +63,17 @@ namespace Spring.Globalization.Formatters
|
||||
Assert.AreEqual("-1,234.56", fmt.Format(-1234.56));
|
||||
|
||||
fmt = new NumberFormatter("sr-SP-Latn");
|
||||
#if NETFRAMEWORK
|
||||
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,000", fmt.Format(1234));
|
||||
Assert.AreEqual("1.234,560", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1.234,000", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1.234,560", fmt.Format(-1234.56));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -101,10 +108,18 @@ namespace Spring.Globalization.Formatters
|
||||
fmt = new NumberFormatter("sr-SP-Cyrl");
|
||||
fmt.GroupSizes = new int[] {1, 2};
|
||||
fmt.GroupSeparator = "'";
|
||||
|
||||
#if NETFRAMEWORK
|
||||
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,000", fmt.Format(1234));
|
||||
Assert.AreEqual("1'23'4,560", fmt.Format(1234.56));
|
||||
Assert.AreEqual("-1'23'4,000", fmt.Format(-1234));
|
||||
Assert.AreEqual("-1'23'4,560", fmt.Format(-1234.56));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -61,8 +61,13 @@ namespace Spring.Globalization.Formatters
|
||||
Assert.AreEqual("25.34%", fmt.Format(0.2534).Replace(" ", ""));
|
||||
|
||||
fmt = new PercentFormatter("sr-SP-Latn");
|
||||
#if NETFRAMEWORK
|
||||
Assert.AreEqual("25,00%", fmt.Format(0.25));
|
||||
Assert.AreEqual("25,34%", fmt.Format(0.2534));
|
||||
#else
|
||||
Assert.AreEqual("25,000%", fmt.Format(0.25));
|
||||
Assert.AreEqual("25,340%", fmt.Format(0.2534));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,7 +66,11 @@ namespace Spring.Objects.Factory.Config
|
||||
}
|
||||
catch (ConfigurationErrorsException cfgex)
|
||||
{
|
||||
#if NETFRAMEWORK
|
||||
Assert.IsInstanceOf(typeof(NotSupportedException), cfgex.InnerException);
|
||||
#else
|
||||
Assert.IsInstanceOf(typeof(ArgumentException), cfgex.InnerException);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Spring
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
* Copyright <EFBFBD> 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#if !MONO
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
@@ -415,5 +413,3 @@ namespace Spring.Data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -601,7 +601,7 @@ namespace Spring.Scheduling.Quartz
|
||||
factoryObject.AfterPropertiesSet();
|
||||
await factoryObject.Start();
|
||||
|
||||
DummyRunnable.runEvent.WaitOne(1000);
|
||||
DummyRunnable.runEvent.WaitOne(TimeSpan.FromSeconds(5));
|
||||
Assert.IsTrue(DummyRunnable.count > 0);
|
||||
|
||||
factoryObject.Dispose();
|
||||
@@ -634,7 +634,7 @@ namespace Spring.Scheduling.Quartz
|
||||
factoryObject.AfterPropertiesSet();
|
||||
await factoryObject.Start();
|
||||
|
||||
Thread.Sleep(500);
|
||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
Assert.AreEqual(10, DummyJobObject.param);
|
||||
Assert.IsTrue(DummyJobObject.count > 0);
|
||||
|
||||
@@ -670,7 +670,7 @@ namespace Spring.Scheduling.Quartz
|
||||
factoryObject.AfterPropertiesSet();
|
||||
await factoryObject.Start();
|
||||
|
||||
Thread.Sleep(500);
|
||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
Assert.AreEqual(10, DummyJob.param);
|
||||
Assert.IsTrue(DummyJob.count > 0);
|
||||
|
||||
@@ -680,7 +680,7 @@ namespace Spring.Scheduling.Quartz
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerWithSpringObjectJobFactoryAndParamMismatchNotIgnored()
|
||||
public async Task TestSchedulerWithSpringObjectJobFactoryAndParamMismatchNotIgnored()
|
||||
{
|
||||
DummyJob.param = 0;
|
||||
DummyJob.count = 0;
|
||||
@@ -707,7 +707,7 @@ namespace Spring.Scheduling.Quartz
|
||||
bean.JobDetails = new IJobDetail[] {jobDetail};
|
||||
bean.AfterPropertiesSet();
|
||||
|
||||
Thread.Sleep(500);
|
||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
Assert.AreEqual(0, DummyJob.param);
|
||||
Assert.IsTrue(DummyJob.count == 0);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
* Copyright <EFBFBD> 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,18 +18,12 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#if !MONO
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.EnterpriseServices;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
#endregion
|
||||
|
||||
/*
|
||||
The code below is only for reverse engineering generated code in reflector
|
||||
*/
|
||||
@@ -75,4 +69,3 @@ namespace Spring.EnterpriseServices
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#if !MONO
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
@@ -212,5 +210,3 @@ namespace Spring.EnterpriseServices
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !MONO
|
||||
|
||||
Reference in New Issue
Block a user