From dca776df2b49e672a8cb9b880d59d805f9901abc Mon Sep 17 00:00:00 2001 From: Craig Hawker Date: Wed, 23 Oct 2024 16:30:45 +0100 Subject: [PATCH] Added unit test for changing to daylight saving. (#140) --- .../ScheduledExecution/WeeklyTriggerTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/MFiles.VAF.Extensions.Tests/Configuration/ScheduledExecution/WeeklyTriggerTests.cs b/MFiles.VAF.Extensions.Tests/Configuration/ScheduledExecution/WeeklyTriggerTests.cs index 9f9b04c..eebdc40 100644 --- a/MFiles.VAF.Extensions.Tests/Configuration/ScheduledExecution/WeeklyTriggerTests.cs +++ b/MFiles.VAF.Extensions.Tests/Configuration/ScheduledExecution/WeeklyTriggerTests.cs @@ -211,5 +211,23 @@ public void WeeklyValueNotReturnedWhenDaylightsavingChanges() var execution = trigger.GetNextExecution(now, TimeZoneInfo.FindSystemTimeZoneById("FLE Standard Time")); Assert.AreEqual(expected.ToUniversalTime(), execution?.ToUniversalTime()); } + + [TestMethod] + public void WeeklyValueNotReturnedWhenDaylightsavingChanges_2() + { + var now = new DateTimeOffset(new DateTime(2025, 3, 26, 9, 0, 0), new TimeSpan(2, 0, 0)); + var expected = new DateTimeOffset(new DateTime(2025, 4, 2, 9, 0, 0), new TimeSpan(3, 0, 0)); + + var trigger = new WeeklyTrigger() + { + TriggerTimes = new List() + { + new TimeSpan(9, 0, 0) + }, + TriggerDays = new List() { DayOfWeek.Wednesday } + }; + var execution = trigger.GetNextExecution(now, TimeZoneInfo.FindSystemTimeZoneById("FLE Standard Time")); + Assert.AreEqual(expected.ToUniversalTime(), execution?.ToUniversalTime()); + } } }