Skip to content

Commit

Permalink
Added unit test for changing to daylight saving. (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
CraigHawker authored Oct 23, 2024
1 parent 803219e commit dca776d
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<TimeSpan>()
{
new TimeSpan(9, 0, 0)
},
TriggerDays = new List<DayOfWeek>() { DayOfWeek.Wednesday }
};
var execution = trigger.GetNextExecution(now, TimeZoneInfo.FindSystemTimeZoneById("FLE Standard Time"));
Assert.AreEqual(expected.ToUniversalTime(), execution?.ToUniversalTime());
}
}
}

0 comments on commit dca776d

Please sign in to comment.