You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
@@ -13,7 +13,7 @@ using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -311,7 +311,7 @@ namespace MonoTests.System {
|
||||
Assert.AreEqual (7, objCOMTest.Id, "#A05");
|
||||
}
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
[Test]
|
||||
[ExpectedException (typeof (MissingMethodException))]
|
||||
public void CreateInstance_TypeBuilder ()
|
||||
@@ -513,7 +513,7 @@ namespace MonoTests.System {
|
||||
null, null);
|
||||
}
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC && !MONOMAC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME && !MONOMAC
|
||||
[Test]
|
||||
public void CreateInstanceCustomDomain ()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -846,7 +846,7 @@ namespace MonoTests.System
|
||||
Assert.IsTrue (custom [2].GetType () == typeof (SerializableAttribute));
|
||||
}
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
[Test]
|
||||
public void GetCustomAttributeOnNewSreTypes ()
|
||||
{
|
||||
|
||||
@@ -171,12 +171,10 @@ namespace MonoTests.System {
|
||||
public void ToStringWithFormatAndCulture ()
|
||||
{
|
||||
DateTimeOffset dto = new DateTimeOffset (2007, 11, 1, 9, 0, 0, new TimeSpan(-7, 0, 0));
|
||||
string format = "dddd, MMM dd yyyy HH:mm:ss zzz";
|
||||
if (CultureInfo.CurrentCulture == CultureInfo.InvariantCulture)
|
||||
Assert.AreEqual ("Thursday, Nov 01 2007 09:00:00 -07:00", dto.ToString (format, null as DateTimeFormatInfo), "ts1");
|
||||
const string format = "dddd, MMM dd yyyy HH:mm:ss zzz";
|
||||
Assert.AreEqual ("Thursday, Nov 01 2007 09:00:00 -07:00", dto.ToString (format, CultureInfo.InvariantCulture), "ts2");
|
||||
Assert.AreEqual ("jeudi, nov. 01 2007 09:00:00 -07:00", dto.ToString (format, new CultureInfo ("fr-FR")), "ts3");
|
||||
Assert.AreEqual ("jueves, Nov. 01 2007 09:00:00 -07:00", dto.ToString (format, new CultureInfo ("es-ES")), "ts4");
|
||||
Assert.AreEqual ("jueves, nov. 01 2007 09:00:00 -07:00", dto.ToString (format, new CultureInfo ("es-ES")), "ts4");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -2646,7 +2646,7 @@ namespace MonoTests.System
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Culture ("en-us")]
|
||||
[SetCulture ("en-us")]
|
||||
public void ToUniversalTime_TimeZoneOffsetShouldNotOverflow ()
|
||||
{
|
||||
var m = DateTime.MaxValue;
|
||||
@@ -2662,7 +2662,7 @@ namespace MonoTests.System
|
||||
res = m.ToUniversalTime ();
|
||||
|
||||
// It does not matter which time zone but we should never overflow or have DateTime.MinValue
|
||||
Assert.AreEqual (0, res.Year, "#10");
|
||||
Assert.AreEqual (1, res.Year, "#10");
|
||||
Assert.AreEqual (1, res.Month, "#11");
|
||||
Assert.AreEqual (1, res.Day, "#12");
|
||||
Assert.AreEqual (DateTimeKind.Utc, res.Kind, "#13");
|
||||
|
||||
@@ -496,7 +496,7 @@ namespace MonoTests.System
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Culture ("en")]
|
||||
[SetCulture ("en")]
|
||||
public void TestParse()
|
||||
{
|
||||
// Boolean Decimal.TryParse(String, NumberStyles, IFormatProvider, Decimal)
|
||||
@@ -810,7 +810,7 @@ namespace MonoTests.System
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Culture ("en")]
|
||||
[SetCulture ("en")]
|
||||
public void TestToString()
|
||||
{
|
||||
// String Decimal.ToString()
|
||||
@@ -865,7 +865,7 @@ namespace MonoTests.System
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Culture ("en")]
|
||||
[SetCulture ("en")]
|
||||
public void TestNumberBufferLimit()
|
||||
{
|
||||
Decimal dE = 1234567890123456789012345.6785m;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.Threading;
|
||||
@@ -26,7 +26,7 @@ namespace MonoTests.System
|
||||
|
||||
|
||||
[Test] //See bug #372406
|
||||
#if MONOTOUCH || MOBILE_STATIC
|
||||
#if MONOTOUCH || FULL_AOT_RUNTIME
|
||||
[Category ("NotWorking")] // #10539
|
||||
#endif
|
||||
public void CreateDelegate1_Method_Private_Instance ()
|
||||
@@ -64,7 +64,7 @@ namespace MonoTests.System
|
||||
}
|
||||
|
||||
[Test] // CreateDelegate (Type, MethodInfo)
|
||||
#if MONOTOUCH || MOBILE_STATIC
|
||||
#if MONOTOUCH || FULL_AOT_RUNTIME
|
||||
[Category ("NotWorking")] // #14163
|
||||
#endif
|
||||
public void CreateDelegate1_Method_Instance ()
|
||||
@@ -925,7 +925,7 @@ namespace MonoTests.System
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if MONOTOUCH || MOBILE_STATIC
|
||||
#if MONOTOUCH || FULL_AOT_RUNTIME
|
||||
[Category ("NotWorking")] // #10539
|
||||
#endif
|
||||
public void Virtual ()
|
||||
@@ -956,7 +956,7 @@ namespace MonoTests.System
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if MONOTOUCH || MOBILE_STATIC
|
||||
#if MONOTOUCH || FULL_AOT_RUNTIME
|
||||
[Category ("NotWorking")] // #14163
|
||||
#endif
|
||||
public void NullTarget_Instance ()
|
||||
@@ -1021,7 +1021,7 @@ namespace MonoTests.System
|
||||
}
|
||||
|
||||
[Test] // #617161
|
||||
#if MONOTOUCH || MOBILE_STATIC
|
||||
#if MONOTOUCH || FULL_AOT_RUNTIME
|
||||
[Category ("NotWorking")] // #10539
|
||||
#endif
|
||||
public void ClosedOverNullReferenceStaticMethod ()
|
||||
@@ -1045,7 +1045,7 @@ namespace MonoTests.System
|
||||
}
|
||||
|
||||
[Test] // #475962
|
||||
#if MONOTOUCH || MOBILE_STATIC
|
||||
#if MONOTOUCH || FULL_AOT_RUNTIME
|
||||
[Category ("NotWorking")] // #10539
|
||||
#endif
|
||||
public void ClosedOverNullReferenceInstanceMethod ()
|
||||
@@ -1079,7 +1079,7 @@ namespace MonoTests.System
|
||||
|
||||
delegate int ByRefDelegate (ref FooStruct s, int a, int b, int c, int d);
|
||||
|
||||
#if MONOTOUCH || MOBILE_STATIC
|
||||
#if MONOTOUCH || FULL_AOT_RUNTIME
|
||||
[Category ("NotWorking")]
|
||||
#endif
|
||||
[Test]
|
||||
@@ -1279,7 +1279,7 @@ namespace MonoTests.System
|
||||
{
|
||||
string retarg (string s);
|
||||
}
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
[Test]
|
||||
public void CreateDelegateWithLdFtnAndAbstractMethod ()
|
||||
{
|
||||
@@ -1388,7 +1388,7 @@ namespace MonoTests.System
|
||||
Assert.IsTrue (d (0, 0));
|
||||
}
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
public static void DynInvokeWithClosedFirstArg (object a, object b)
|
||||
{
|
||||
}
|
||||
@@ -1453,6 +1453,26 @@ namespace MonoTests.System
|
||||
Delegate.CreateDelegate(typeof(Action), this, m);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReflectedTypeInheritedVirtualMethod ()
|
||||
{
|
||||
var a = new DerivedClass ();
|
||||
|
||||
Action m = a.MyMethod;
|
||||
Assert.AreEqual (typeof (BaseClass), m.Method.ReflectedType);
|
||||
}
|
||||
|
||||
class BaseClass
|
||||
{
|
||||
public virtual void MyMethod() {
|
||||
Console.WriteLine ("Base method");
|
||||
}
|
||||
}
|
||||
|
||||
class DerivedClass : BaseClass
|
||||
{
|
||||
}
|
||||
|
||||
public void AnyGenericMethod<T>()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace MonoTests.System
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Culture ("en-US")]
|
||||
[SetCulture ("en-US")]
|
||||
public void Parse ()
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@@ -15,10 +15,6 @@ using System.Threading;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !MOBILE
|
||||
using NUnit.Framework.SyntaxHelpers;
|
||||
#endif
|
||||
|
||||
namespace MonoTests.System
|
||||
{
|
||||
[TestFixture]
|
||||
|
||||
@@ -82,8 +82,6 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void DeltaNotInSeconds ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
throw new ArgumentOutOfRangeException ();;
|
||||
DateTime dateStart = new DateTime (2007,01,01);
|
||||
DateTime dateEnd = new DateTime (2008,01,01);
|
||||
TimeZoneInfo.TransitionTime daylightTransitionStart = TimeZoneInfo.TransitionTime.CreateFixedDateRule (new DateTime (1,1,1,2,0,0), 03, 11);
|
||||
|
||||
@@ -43,6 +43,39 @@ namespace MonoTests.System
|
||||
static FieldInfo cachedDataField;
|
||||
static object localFieldObj;
|
||||
|
||||
public static string MapTimeZoneId (string id)
|
||||
{
|
||||
if (Environment.OSVersion.Platform == PlatformID.Unix)
|
||||
return id;
|
||||
else {
|
||||
switch (id) {
|
||||
case "Pacific/Auckland":
|
||||
return "New Zealand Standard Time";
|
||||
case "Europe/Athens":
|
||||
return "GTB Standard Time";
|
||||
case "US/Eastern":
|
||||
return "Eastern Standard Time";
|
||||
case "US/Pacific":
|
||||
return "Pacific Standard Time";
|
||||
case "Australia/Sydney":
|
||||
case "Australia/Melbourne":
|
||||
return "AUS Eastern Standard Time";
|
||||
case "Europe/Brussels":
|
||||
return "Romance Standard Time";
|
||||
case "Africa/Kinshasa":
|
||||
return "W. Central Africa Standard Time";
|
||||
case "Europe/Rome":
|
||||
case "Europe/Vatican":
|
||||
return "W. Europe Standard Time";
|
||||
case "Canada/Eastern":
|
||||
return "Eastern Standard Time";
|
||||
default:
|
||||
Assert.Fail ($"No mapping defined for zone id '{id}'");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetLocal (TimeZoneInfo val)
|
||||
{
|
||||
if (localField == null) {
|
||||
@@ -70,8 +103,6 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void GetLocal ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
TimeZoneInfo local = TimeZoneInfo.Local;
|
||||
Assert.IsNotNull (local);
|
||||
Assert.IsTrue (true);
|
||||
@@ -262,8 +293,6 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void DSTInLondon ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
DateTime june01 = new DateTime (2007, 06, 01);
|
||||
DateTime xmas = new DateTime (2007, 12, 25);
|
||||
Assert.IsTrue (london.IsDaylightSavingTime (june01), "June 01 is DST in London");
|
||||
@@ -273,8 +302,6 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void DSTTransisions ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
DateTime beforeDST = new DateTime (2007, 03, 25, 0, 59, 59, DateTimeKind.Unspecified);
|
||||
DateTime startDST = new DateTime (2007, 03, 25, 2, 0, 0, DateTimeKind.Unspecified);
|
||||
DateTime endDST = new DateTime (2007, 10, 28, 1, 59, 59, DateTimeKind.Unspecified);
|
||||
@@ -315,12 +342,7 @@ namespace MonoTests.System
|
||||
[Test (Description="Description xambug #17155")]
|
||||
public void AdjustmentRuleAfterNewYears ()
|
||||
{
|
||||
TimeZoneInfo tz;
|
||||
if (Environment.OSVersion.Platform == PlatformID.Unix)
|
||||
tz = TimeZoneInfo.FindSystemTimeZoneById ("Pacific/Auckland"); // *nix
|
||||
else
|
||||
tz = TimeZoneInfo.FindSystemTimeZoneById ("New Zealand Standard Time"); // Windows
|
||||
|
||||
TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Pacific/Auckland"));
|
||||
// DST start: 9/29/2013 2:00:00 AM
|
||||
// DST end: 4/6/2014 3:00:00 AM
|
||||
DateTime dt = new DateTime (2014, 1, 9, 23, 0, 0, DateTimeKind.Utc);
|
||||
@@ -354,16 +376,87 @@ namespace MonoTests.System
|
||||
[Test] //Covers #25050
|
||||
public void TestAthensDST ()
|
||||
{
|
||||
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Athens");
|
||||
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Athens"));
|
||||
var date = new DateTime (2014, 3, 30 , 2, 0, 0);
|
||||
Assert.IsFalse (tzi.IsDaylightSavingTime (date));
|
||||
Assert.AreEqual (new TimeSpan (2,0,0), tzi.GetUtcOffset (date));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAthensDST_InDSTDelta ()
|
||||
{
|
||||
// In .NET GetUtcOffset() returns the BaseUtcOffset for times within the hour
|
||||
// lost when DST starts but IsDaylightSavingTime() returns true.
|
||||
|
||||
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Athens"));
|
||||
|
||||
var date = new DateTime (2014, 3, 30 , 3, 0, 0);
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (date));
|
||||
Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
|
||||
|
||||
date = new DateTime (2014, 3, 30 , 3, 1, 0);
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (date));
|
||||
Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
|
||||
|
||||
date = new DateTime (2014, 3, 30 , 3, 59, 0);
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (date));
|
||||
Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
|
||||
|
||||
date = new DateTime (2014, 3, 30 , 4, 0, 0);
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (date));
|
||||
Assert.AreEqual (new TimeSpan (3, 0, 0), tzi.GetUtcOffset (date));
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAthensDST_InDSTDelta_NoTransitions ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("TimeZoneInfo on Mono on Windows and .NET has no transitions");
|
||||
|
||||
// Repeat the previous test but this time force using AdjustmentRules by nulling out TimeZoneInfo.transitions
|
||||
|
||||
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Athens");
|
||||
|
||||
var transitionsField = typeof (TimeZoneInfo).GetField ("transitions", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
var transitions = transitionsField.GetValue (tzi);
|
||||
Assert.IsNotNull (transitions, "Expected Athens TimeZoneInfo.transitions to be non-null");
|
||||
transitionsField.SetValue (tzi, null);
|
||||
|
||||
try {
|
||||
|
||||
var date = new DateTime (2014, 3, 30 , 3, 0, 0);
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (date));
|
||||
Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
|
||||
|
||||
date = new DateTime (2014, 3, 30 , 3, 1, 0);
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (date));
|
||||
Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
|
||||
|
||||
date = new DateTime (2014, 3, 30 , 3, 59, 0);
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (date));
|
||||
Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
|
||||
|
||||
date = new DateTime (2014, 3, 30 , 4, 0, 0);
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (date));
|
||||
Assert.AreEqual (new TimeSpan (3, 0, 0), tzi.GetUtcOffset (date));
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
|
||||
|
||||
} finally {
|
||||
transitionsField.SetValue (tzi, transitions);
|
||||
}
|
||||
}
|
||||
|
||||
[Test] //Covers #41349
|
||||
public void TestIsDST_DateTimeOffset ()
|
||||
{
|
||||
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Athens");
|
||||
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Athens"));
|
||||
var date = new DateTime (2014, 3, 30 , 2, 0, 0);
|
||||
var offset = tzi.GetUtcOffset (date);
|
||||
var dateOffset = new DateTimeOffset (date, offset);
|
||||
@@ -415,8 +508,6 @@ namespace MonoTests.System
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void ConvertFromUtc_KindIsLocalException ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
throw new ArgumentException ();
|
||||
TimeZoneInfo.ConvertTimeFromUtc (new DateTime (2007, 5, 3, 11, 8, 0, DateTimeKind.Local), TimeZoneInfo.Local);
|
||||
}
|
||||
|
||||
@@ -438,8 +529,6 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void ConvertFromUTC_ConvertInWinter ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
DateTime utc = new DateTime (2007, 12, 25, 12, 0, 0);
|
||||
DateTime converted = TimeZoneInfo.ConvertTimeFromUtc (utc, london);
|
||||
Assert.AreEqual (utc, converted);
|
||||
@@ -448,8 +537,6 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void ConvertFromUtc_ConvertInSummer ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
DateTime utc = new DateTime (2007, 06, 01, 12, 0, 0);
|
||||
DateTime converted = TimeZoneInfo.ConvertTimeFromUtc (utc, london);
|
||||
Assert.AreEqual (utc + new TimeSpan (1,0,0), converted);
|
||||
@@ -475,8 +562,6 @@ namespace MonoTests.System
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void ConvertToUTC_KindIsLocalButSourceIsNot ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
throw new ArgumentException ();
|
||||
TimeZoneInfo.ConvertTimeToUtc (new DateTime (2007, 5, 3, 12, 8, 0, DateTimeKind.Local), london);
|
||||
}
|
||||
|
||||
@@ -507,8 +592,6 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void ConvertFromToUtc ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
DateTime utc = DateTime.UtcNow;
|
||||
Assert.AreEqual (utc.Kind, DateTimeKind.Utc);
|
||||
DateTime converted = TimeZoneInfo.ConvertTimeFromUtc (utc, london);
|
||||
@@ -557,10 +640,7 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void ConvertToTimeZone ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
|
||||
TimeZoneInfo.ConvertTime (DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Pacific/Auckland"));
|
||||
TimeZoneInfo.ConvertTime (DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Pacific/Auckland")));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -607,11 +687,7 @@ namespace MonoTests.System
|
||||
[Test (Description="Fix for xambug https://bugzilla.xamarin.com/show_bug.cgi?id=17155")]
|
||||
public void ConvertTime_AdjustmentRuleAfterNewYears ()
|
||||
{
|
||||
TimeZoneInfo tz;
|
||||
if (Environment.OSVersion.Platform == PlatformID.Unix)
|
||||
tz = TimeZoneInfo.FindSystemTimeZoneById ("Pacific/Auckland"); // *nix
|
||||
else
|
||||
tz = TimeZoneInfo.FindSystemTimeZoneById ("New Zealand Standard Time"); // Windows
|
||||
TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Pacific/Auckland"));
|
||||
|
||||
// DST start: 9/29/2013 2:00:00 AM
|
||||
// DST end: 4/6/2014 3:00:00 AM
|
||||
@@ -650,19 +726,8 @@ namespace MonoTests.System
|
||||
[Test (Description="Fix the bug https://bugzilla.xamarin.com/show_bug.cgi?id=1849")]
|
||||
public void ConvertTime_AjustmentConvertTimeWithSourceTimeZone () {
|
||||
|
||||
TimeZoneInfo easternTimeZone;
|
||||
TimeZoneInfo pacificTimeZone;
|
||||
|
||||
if (Environment.OSVersion.Platform == PlatformID.Unix) {
|
||||
// *nix
|
||||
easternTimeZone = TimeZoneInfo.FindSystemTimeZoneById ("US/Eastern");
|
||||
pacificTimeZone = TimeZoneInfo.FindSystemTimeZoneById ("US/Pacific");
|
||||
}
|
||||
else {
|
||||
// Windows
|
||||
easternTimeZone = TimeZoneInfo.FindSystemTimeZoneById ("Eastern Standard Time");
|
||||
pacificTimeZone = TimeZoneInfo.FindSystemTimeZoneById ("Pacific Standard Time");
|
||||
}
|
||||
TimeZoneInfo easternTimeZone = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("US/Eastern"));
|
||||
TimeZoneInfo pacificTimeZone = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("US/Pacific"));
|
||||
|
||||
DateTime lastMidnight = new DateTime (new DateTime (2012, 06, 13).Ticks, DateTimeKind.Unspecified);
|
||||
DateTime lastMidnightAsEST = TimeZoneInfo.ConvertTime (lastMidnight, pacificTimeZone, easternTimeZone);
|
||||
@@ -735,8 +800,6 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void AmbiguousDates ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
Assert.IsFalse (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 1, 0, 0)));
|
||||
Assert.IsTrue (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 1, 0, 1)));
|
||||
Assert.IsTrue (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 2, 0, 0)));
|
||||
@@ -746,8 +809,6 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void AmbiguousUTCDates ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
Assert.IsFalse (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 0, 0, 0, DateTimeKind.Utc)));
|
||||
Assert.IsTrue (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 0, 0, 1, DateTimeKind.Utc)));
|
||||
Assert.IsTrue (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 0, 59, 59, DateTimeKind.Utc)));
|
||||
@@ -777,8 +838,6 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void NotEmpty ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
global::System.Collections.ObjectModel.ReadOnlyCollection<TimeZoneInfo> systemTZ = TimeZoneInfo.GetSystemTimeZones ();
|
||||
Assert.IsNotNull(systemTZ, "SystemTZ is null");
|
||||
Assert.IsFalse (systemTZ.Count == 0, "SystemTZ is empty");
|
||||
@@ -787,11 +846,9 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void ContainsBrussels ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
global::System.Collections.ObjectModel.ReadOnlyCollection<TimeZoneInfo> systemTZ = TimeZoneInfo.GetSystemTimeZones ();
|
||||
foreach (TimeZoneInfo tz in systemTZ) {
|
||||
if (tz.Id == "Europe/Brussels")
|
||||
if (tz.Id == MapTimeZoneId ("Europe/Brussels"))
|
||||
return;
|
||||
}
|
||||
Assert.Fail ("Europe/Brussels not found in SystemTZ");
|
||||
@@ -832,72 +889,56 @@ namespace MonoTests.System
|
||||
[ExpectedException (typeof (TimeZoneNotFoundException))]
|
||||
public void NonSystemTimezone ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
throw new TimeZoneNotFoundException ();
|
||||
TimeZoneInfo.FindSystemTimeZoneById ("Neverland/The_Lagoon");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FindBrusselsTZ ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Brussels");
|
||||
TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Brussels"));
|
||||
Assert.IsNotNull (brussels);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OffsetIsCorrectInKinshasa ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
TimeZoneInfo kin = TimeZoneInfo.FindSystemTimeZoneById ("Africa/Kinshasa");
|
||||
TimeZoneInfo kin = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Africa/Kinshasa"));
|
||||
Assert.AreEqual (new TimeSpan (1,0,0), kin.BaseUtcOffset, "BaseUtcOffset in Kinshasa is not +1h");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OffsetIsCorrectInBrussels ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Brussels");
|
||||
TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Brussels"));
|
||||
Assert.AreEqual (new TimeSpan (1,0,0), brussels.BaseUtcOffset, "BaseUtcOffset for Brussels is not +1h");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NoDSTInKinshasa ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
TimeZoneInfo kin = TimeZoneInfo.FindSystemTimeZoneById ("Africa/Kinshasa");
|
||||
TimeZoneInfo kin = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Africa/Kinshasa"));
|
||||
Assert.IsFalse (kin.SupportsDaylightSavingTime);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BrusselsSupportsDST ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Brussels");
|
||||
TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Brussels"));
|
||||
Assert.IsTrue (brussels.SupportsDaylightSavingTime);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MelbourneSupportsDST ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
TimeZoneInfo melbourne = TimeZoneInfo.FindSystemTimeZoneById ("Australia/Melbourne");
|
||||
TimeZoneInfo melbourne = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Australia/Melbourne"));
|
||||
Assert.IsTrue (melbourne.SupportsDaylightSavingTime);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RomeAndVaticanSharesTime ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
TimeZoneInfo rome = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Rome");
|
||||
TimeZoneInfo vatican = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Vatican");
|
||||
TimeZoneInfo rome = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Rome"));
|
||||
TimeZoneInfo vatican = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Vatican"));
|
||||
Assert.IsTrue (rome.HasSameRules (vatican));
|
||||
}
|
||||
|
||||
@@ -967,9 +1008,7 @@ namespace MonoTests.System
|
||||
[ExpectedException (typeof(ArgumentException))]
|
||||
public void DateIsNotAmbiguous ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
throw new ArgumentException ();
|
||||
TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Brussels");
|
||||
TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Brussels"));
|
||||
DateTime date = new DateTime (2007, 05, 11, 11, 40, 00);
|
||||
brussels.GetAmbiguousTimeOffsets (date);
|
||||
}
|
||||
@@ -977,9 +1016,7 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void AmbiguousOffsets ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Brussels");
|
||||
TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Brussels"));
|
||||
DateTime date = new DateTime (2007, 10, 28, 2, 30, 00);
|
||||
Assert.IsTrue (brussels.IsAmbiguousTime (date));
|
||||
Assert.AreEqual (2, brussels.GetAmbiguousTimeOffsets (date).Length);
|
||||
@@ -1214,11 +1251,7 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void TestSydneyDaylightChanges ()
|
||||
{
|
||||
TimeZoneInfo tz;
|
||||
if (Environment.OSVersion.Platform == PlatformID.Unix)
|
||||
tz = TimeZoneInfo.FindSystemTimeZoneById ("Australia/Sydney");
|
||||
else
|
||||
tz = TimeZoneInfo.FindSystemTimeZoneById ("W. Australia Standard Time");
|
||||
TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Australia/Sydney"));
|
||||
|
||||
var changes = (DaylightTime) getChanges.Invoke (tz, new object [] {2014});
|
||||
|
||||
@@ -1227,6 +1260,18 @@ namespace MonoTests.System
|
||||
Assert.AreEqual (new DateTime (2014, 4, 6, 3, 0, 0), changes.End);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAthensDaylightChanges ()
|
||||
{
|
||||
TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Athens"));
|
||||
|
||||
var changes = (DaylightTime) getChanges.Invoke (tz, new object [] {2014});
|
||||
|
||||
Assert.AreEqual (new TimeSpan (1, 0, 0), changes.Delta);
|
||||
Assert.AreEqual (new DateTime (2014, 3, 30, 3, 0, 0), changes.Start);
|
||||
Assert.AreEqual (new DateTime (2014, 10, 26, 4, 0, 0), changes.End);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AllTimeZonesDaylightChanges ()
|
||||
{
|
||||
|
||||
@@ -23,8 +23,8 @@ public class TimeZoneTest {
|
||||
|
||||
private void CET (TimeZone t1)
|
||||
{
|
||||
Assert.AreEqual("CET", t1.StandardName, "A01");
|
||||
Assert.AreEqual("CEST", t1.DaylightName, "A02");
|
||||
Assert.IsTrue("CET" == t1.StandardName || "W. Europe Standard Time" == t1.StandardName, "A01");
|
||||
Assert.IsTrue("CEST" == t1.DaylightName || "W. Europe Daylight Time" == t1.DaylightName, "A02");
|
||||
|
||||
DaylightTime d1 = t1.GetDaylightChanges (2002);
|
||||
Assert.AreEqual("03/31/2002 02:00:00", d1.Start.ToString ("G", CultureInfo.InvariantCulture), "A03");
|
||||
@@ -55,9 +55,8 @@ public class TimeZoneTest {
|
||||
|
||||
private void EST (TimeZone t1)
|
||||
{
|
||||
// It could be EST though...
|
||||
//Assert.AreEqual("Eastern Standard Time", t1.StandardName, "B01");
|
||||
//Assert.AreEqual("Eastern Daylight Time", t1.DaylightName, "B02");
|
||||
Assert.IsTrue("EST" == t1.StandardName || "Eastern Standard Time" == t1.StandardName, "B01");
|
||||
Assert.IsTrue("EDT" == t1.DaylightName || "Eastern Daylight Time" == t1.DaylightName, "B02");
|
||||
|
||||
DaylightTime d1 = t1.GetDaylightChanges (2002);
|
||||
Assert.AreEqual("04/07/2002 02:00:00", d1.Start.ToString ("G", CultureInfo.InvariantCulture), "B03");
|
||||
@@ -174,6 +173,7 @@ public class TimeZoneTest {
|
||||
{
|
||||
TimeZone t1 = TimeZone.CurrentTimeZone;
|
||||
switch (t1.StandardName) {
|
||||
case "W. Europe Standard Time":
|
||||
case "CET":
|
||||
CET (t1);
|
||||
break;
|
||||
@@ -320,9 +320,9 @@ public class TimeZoneTest {
|
||||
[Test]
|
||||
public void FindSystemTimeZoneById ()
|
||||
{
|
||||
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Canada/Eastern");
|
||||
Assert.AreEqual ("EDT", tzi.DaylightName, "DaylightName");
|
||||
Assert.AreEqual ("EST", tzi.StandardName, "StandardName");
|
||||
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById (TimeZoneInfoTest.MapTimeZoneId ("Canada/Eastern"));
|
||||
Assert.IsTrue ("EDT" == tzi.DaylightName || "Eastern Daylight Time" == tzi.DaylightName, "DaylightName");
|
||||
Assert.IsTrue ("EST" == tzi.StandardName || "Eastern Standard Time" == tzi.StandardName, "StandardName");
|
||||
Assert.IsTrue (tzi.SupportsDaylightSavingTime, "SupportsDaylightSavingTime");
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ public class TimeZoneTest {
|
||||
dto.ToLocalTime ();
|
||||
}
|
||||
|
||||
#if MOBILE
|
||||
#if !WIN_PLATFORM
|
||||
// On device we cannot read the OS file system to look for /etc/localtime
|
||||
// and /usr/share/zoneinfo - so we must initialize the BCL TimeZoneInfo
|
||||
// from NSTimeZoneInfo. The tests here check the code paths between the
|
||||
@@ -359,7 +359,7 @@ public class TimeZoneTest {
|
||||
// now it fails on Snow Leopard the same way (incomplete data) with iOS5 simulator (OS update ?)
|
||||
// but it *never*ever* failed on devices
|
||||
incomplete_data_on_simulator_only_bug = true;
|
||||
#if XAMCORE_2_0 || MONOTOUCH
|
||||
#if MONOTOUCH
|
||||
|
||||
#if XAMCORE_2_0
|
||||
if (ObjCRuntime.Runtime.Arch == ObjCRuntime.Arch.SIMULATOR)
|
||||
@@ -367,7 +367,7 @@ public class TimeZoneTest {
|
||||
if (MonoTouch.ObjCRuntime.Runtime.Arch == MonoTouch.ObjCRuntime.Arch.SIMULATOR)
|
||||
#endif
|
||||
Assert.Ignore ("known to fail on some iOS simulator versions - see source comments");
|
||||
#endif // XAMCORE_2_0 || MONOTOUCH
|
||||
#endif // MONOTOUCH
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1 +1 @@
|
||||
3b59d6b952aa1995bae24cea0f13675747fc7848
|
||||
100f1c362742134360fd3562f632b1192f0d50c3
|
||||
Reference in New Issue
Block a user