Skip to content

Commit e9e92d9

Browse files
committed
Fixed bug in fixed values in schedule. Added test for leap years.
1 parent 8824eae commit e9e92d9

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

PointerPlace.Scheduler/PointerPlace.Scheduler.Test/ScheduleTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,21 @@ public void TestYearRollover()
7272
Assert.AreEqual(0, point.Millisecond);
7373
}
7474

75+
[TestMethod]
76+
public void TestLeapYear()
77+
{
78+
var point = new DateTime(2017, 11, 29, 20, 52, 37);
79+
80+
point = Scheduler.GetNext("0 0 29 2 *", point);
81+
82+
Assert.AreEqual(2020, point.Year);
83+
Assert.AreEqual(2, point.Month);
84+
Assert.AreEqual(29, point.Day);
85+
Assert.AreEqual(0, point.Hour);
86+
Assert.AreEqual(0, point.Minute);
87+
Assert.AreEqual(0, point.Second);
88+
Assert.AreEqual(0, point.Millisecond);
89+
}
90+
7591
}
7692
}

PointerPlace.Scheduler/PointerPlace.Scheduler/ScheduleParser.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ private static ScheduleEntryValue ParseScheduleEntryValue(string scheduleEntryVa
138138
var value = ParseScheduleEntryValueInner(scheduleEntryValue);
139139
return new ScheduleEntryValue
140140
{
141-
Value = value
141+
Value = value,
142+
Threshold = value
142143
};
143144
}
144145
// This is a range

0 commit comments

Comments
 (0)