Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ TimeZoneInfo timezoneInfo
}.GetNextExecution(after, timezoneInfo);
Assert.AreEqual(expected?.ToUniversalTime(), execution?.ToUniversalTime());
}
[TestMethod]
public void NullAfterDoesNotThrow
(
)
{
var execution = new DailyTrigger()
{
TriggerTimes = new List<TimeSpan>
{
new TimeSpan(10, 0, 0)
}
}.GetNextExecution(null);
}

public static IEnumerable<object[]> GetNextExecutionData()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public DailyTrigger()
timeZoneInfo = timeZoneInfo ?? TimeZoneInfo.Local;

// When should we start looking?
var before = after.Value;
after = (after ?? DateTime.UtcNow).ToUniversalTime();
var before = (after ?? DateTime.UtcNow);
after = before.ToUniversalTime();

// Convert the time into the timezone we're after.
after = TimeZoneInfo.ConvertTime(after.Value, timeZoneInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public class Schedule
// Get the next execution date from the triggers.
var next = this.Triggers?
.Select(t => t.GetNextExecution(after, timeZoneInfo))
.Where(d => d.HasValue && d.Value.DateTime != DateTime.MinValue)
.Where(d => d.HasValue)
.Where(d => d.Value.DateTime != DateTime.MinValue)
.OrderBy(d => d);
return next.Any() ? next.First() : null;
}
Expand Down
Loading