public void Setup() { _mockScheduler = MockRepository.GenerateMock <IScheduler>(); _mockProcessManager = MockRepository.GenerateMock <IProcessManager>(); _calendars = CustomCalendarFactory.CreateAnnualCalendarsWithSpecifiedDatesExcluded( new List <CustomCalendarDefinition>() { new CustomCalendarDefinition() { CalendarName = "AU_Without_Public_Holidays", Action = "exclude", Dates = new [] { new DateTime(2017, 1, 1), } } }); _conductor = new Conductor(new List <JobDefinition>(), new List <ICalendar>(), 2000, 2000, _mockScheduler, _mockProcessManager); }
public SchedulerHost() { try { _logger = LogManager.GetLogger <SchedulerHost>(); var jobDefinitions = JobConfig.CreateJobDefinitions(SchedulerConfig.JobsFile); var calendarDefinitions = CustomCalendarConfig.CreateCalendarDefinitions(SchedulerConfig.CalendarsFile); var customCalendars = CustomCalendarFactory.CreateAnnualCalendarsWithSpecifiedDatesExcluded(calendarDefinitions); _conductor = new Conductor(jobDefinitions, customCalendars, 60000, 90000); } catch (Exception e) { _logger.Error($"In constructor: {e.Message}\n\r{e.StackTrace}"); throw; } }
public void CreateAnnualCalendarsWithSpecifiedDatesExcluded_WillCreateCorrectly() { var calendar1 = new CustomCalendarDefinition { CalendarName = "Holiday", Action = "exclude", Dates = new[] { new DateTime(2017, 1, 5), new DateTime(2017, 5, 4) } }; var calendar2 = new CustomCalendarDefinition { CalendarName = "Release days", Action = "exclude", Dates = new[] { new DateTime(2017, 3, 7), new DateTime(2017, 9, 14) } }; var calendars = CustomCalendarFactory.CreateAnnualCalendarsWithSpecifiedDatesExcluded( new List <CustomCalendarDefinition>() { calendar1, calendar2 }); Assert.AreEqual(2, calendars.Count); Assert.AreEqual("Holiday", calendars[0].Description); Assert.IsInstanceOf <AnnualCalendar>(calendars[0]); var annualCalendar1 = (AnnualCalendar)calendars[0]; Assert.AreEqual(2, annualCalendar1.DaysExcluded.Count); Assert.IsTrue(annualCalendar1.IsDayExcluded(new DateTimeOffset(calendar1.Dates[0]))); Assert.IsTrue(annualCalendar1.IsDayExcluded(new DateTimeOffset(calendar1.Dates[1]))); Assert.AreEqual("Release days", calendars[1].Description); Assert.IsInstanceOf <AnnualCalendar>(calendars[1]); var annualCalendar2 = (AnnualCalendar)calendars[1]; Assert.AreEqual(2, annualCalendar2.DaysExcluded.Count); Assert.IsTrue(annualCalendar2.IsDayExcluded(new DateTimeOffset(calendar2.Dates[0]))); Assert.IsTrue(annualCalendar2.IsDayExcluded(new DateTimeOffset(calendar2.Dates[1]))); }