public void Match_EveryMonths() { var cron = new Cron { Second = 0, Minute = 0, Hour = 0, Day = 1 }; Assert.True(cron.Match(DateTimeOffset.Parse("2018-01-01T00:00:00"))); Assert.True(cron.Match(DateTimeOffset.Parse("2018-02-01T00:00:00"))); Assert.True(cron.Match(DateTimeOffset.Parse("2018-03-01T00:00:00"))); Assert.True(cron.Match(DateTimeOffset.Parse("2018-04-01T00:00:00"))); Assert.True(cron.Match(DateTimeOffset.Parse("2018-05-01T00:00:00"))); Assert.False(cron.Match(DateTimeOffset.Parse("2018-01-01T00:00:01"))); Assert.False(cron.Match(DateTimeOffset.Parse("2018-01-01T00:01:00"))); Assert.False(cron.Match(DateTimeOffset.Parse("2018-01-01T01:00:00"))); Assert.False(cron.Match(DateTimeOffset.Parse("2018-01-02T00:00:00"))); }
public void Match_Sunday_ap0() { var cron = new Cron { Second = 0, Minute = 0, Hour = 0, DayOfWeek = 0 }; Assert.True(cron.Match(DateTimeOffset.Parse("2018-02-04T00:00:00"))); Assert.True(cron.Match(DateTimeOffset.Parse("2018-02-11T00:00:00"))); Assert.True(cron.Match(DateTimeOffset.Parse("2018-02-18T00:00:00"))); Assert.True(cron.Match(DateTimeOffset.Parse("2018-02-25T00:00:00"))); Assert.False(cron.Match(DateTimeOffset.Parse("2018-02-05T00:00:00"))); Assert.False(cron.Match(DateTimeOffset.Parse("2018-02-12T00:00:00"))); Assert.False(cron.Match(DateTimeOffset.Parse("2018-02-20T01:00:00"))); Assert.False(cron.Match(DateTimeOffset.Parse("2018-02-28T00:00:00"))); }
public void Match_EveryHours() { var cron = new Cron { Second = 0, Minute = 0 }; Assert.True(cron.Match(DateTimeOffset.Parse("2018-01-01T00:00:00"))); Assert.True(cron.Match(DateTimeOffset.Parse("2018-01-01T01:00:00"))); Assert.True(cron.Match(DateTimeOffset.Parse("2018-01-01T02:00:00"))); Assert.True(cron.Match(DateTimeOffset.Parse("2018-01-01T03:00:00"))); Assert.True(cron.Match(DateTimeOffset.Parse("2018-01-01T04:00:00"))); Assert.False(cron.Match(DateTimeOffset.Parse("2018-01-01T00:00:01"))); Assert.False(cron.Match(DateTimeOffset.Parse("2018-01-01T00:01:00"))); }
public void Match_EverySeconds() { var cron = new Cron(); Assert.True(cron.Match(DateTimeOffset.Now)); }