void Cell_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Title") title.Text = Cell.Title; else if (e.PropertyName == "Date") cellCalculator = new ScheduleCalculator(Cell.Date); }
public void TestMatchEachTwoHours() { IScheduleCalculator scheduleCalculator = new ScheduleCalculator(); Schedule schedule = new Schedule() { Ever = false, CycleValue = 2, CycleUnit = CycleUnit.hours, Continuous = false, //von 08:00 bis 09:00 TimeHourFrom = 8, TimeMinuteFrom = 0, TimeHourTo = 9, TimeMinuteTo = 0 }; DateTime last = DateTime.ParseExact("2009-05-08 06:20", "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture); DateTime now = DateTime.ParseExact("2009-05-08 08:41", "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture); Assert.IsTrue(scheduleCalculator.Match(schedule, now, last)); }
static void Main(string[] args) { for (var date = new HebrewDate(new DateTime(2015, 1, 1)); date.EnglishDate.Year <= 2020; date++) { var calc = new ScheduleCalculator(date); Console.WriteLine("---- " + date.EnglishDate.ToShortDateString() + " " + date.DayOfWeek + ": " + date.ToString("d") + " " + calc.CalcTitle()); foreach (var time in calc.CalcTimes().OrderBy(c => c.Time)) { Console.WriteLine((time.Name + ":").PadRight(10) + time.TimeString + (time.IsBold ? " **" : "")); } Console.WriteLine(); Console.WriteLine(); } if (!Console.IsOutputRedirected) { Console.ReadKey(); } }
public void TestMatchEver() { IScheduleCalculator scheduleCalculator = new ScheduleCalculator(); Schedule schedule = new Schedule() { Ever = true, Continuous = true }; DateTime last = DateTime.ParseExact("2009-05-08 14:40", "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture); DateTime now = DateTime.ParseExact("2009-05-08 14:41", "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture); Assert.IsTrue(scheduleCalculator.Match(schedule, now, last)); }
public void TestMatchRange() { IScheduleCalculator scheduleCalculator = new ScheduleCalculator(); Schedule schedule = new Schedule() { Continuous = false, //von 08:00 bis 09:00 TimeHourFrom = 8, TimeMinuteFrom = 0, TimeHourTo = 9, TimeMinuteTo = 0 }; DateTime intime = DateTime.ParseExact("2009-05-08 08:00", "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture); DateTime outtime = DateTime.ParseExact("2009-05-08 07:59", "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture); Assert.IsTrue(scheduleCalculator.MatchRange(schedule, intime)); Assert.IsFalse(scheduleCalculator.MatchRange(schedule, outtime)); }
public void TestMatchEverWithRange() { IScheduleCalculator scheduleCalculator = new ScheduleCalculator(); Schedule schedule = new Schedule() { Ever = true, Continuous = false, //von 08:00 bis 09:00 TimeHourFrom = 8, TimeMinuteFrom = 0, TimeHourTo = 9, TimeMinuteTo = 0 }; DateTime last = DateTime.ParseExact("2009-05-08 14:40", "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture); DateTime now = DateTime.ParseExact("2009-05-08 14:41", "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture); Assert.IsFalse(scheduleCalculator.Match(schedule, now, last)); }
// ---------------------------------------------------------------------- public ThermostatDemo() { calculator = new ScheduleCalculator<TimeRange>( GetScheduleWeek() ); SetupHolidays( calculator.Holidays ); }
public void SetUp() { ScheduleRepositoryMock = new Mock <IRepository <Schedule> >(); ClockMock = new Mock <IClock>(); Calculator = new ScheduleCalculator(ScheduleRepositoryMock.Object, ClockMock.Object); }
public void SetUp() { ScheduleRepositoryMock = new Mock<IRepository<Schedule>>(); ClockMock = new Mock<IClock>(); Calculator = new ScheduleCalculator(ScheduleRepositoryMock.Object, ClockMock.Object); }