Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added test case for daylight changes by Christian Bang

  • Loading branch information...
commit b2d1db3bc94a6c1472c3dd5bc863b7ccf09c1166 1 parent 76d26c8
@lahma lahma authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/Quartz.Tests.Unit/CronExpressionTest.cs
View
16 src/Quartz.Tests.Unit/CronExpressionTest.cs
@@ -508,6 +508,22 @@ public void TestQtz259Lw()
}
}
+ [Test]
+ public void TestDaylightSaving_QRTZNETZ186()
+ {
+ CronExpression expression = new CronExpression("0 15 * * * ?");
+ if (!TimeZoneInfo.Local.SupportsDaylightSavingTime)
+ {
+ return;
+ }
+ var daylightChange = TimeZone.CurrentTimeZone.GetDaylightChanges(2012);
+ DateTimeOffset before = daylightChange.Start.ToUniversalTime().AddMinutes(-5); // keep outside the potentially undefined interval
+ DateTimeOffset? after = expression.GetNextValidTimeAfter(before);
+ Assert.IsTrue(after.HasValue);
+ DateTimeOffset expected = daylightChange.Start.Add(daylightChange.Delta).AddMinutes(15).ToUniversalTime();
+ Assert.AreEqual(expected, after.Value);
+ }
+
private class SimpleCronExpression : CronExpression
{
public SimpleCronExpression(string cronExpression)
Please sign in to comment.
Something went wrong with that request. Please try again.