示例#1
0
        public void When_TimeToRunTaskOccurs_Task_Is_Run()
        {
            var substituteForTask = Substitute.For<IVolatileTask>();
            var substituteForSchedule = Substitute.For<StubSchedule>();
            var taskbuilder = new StubTaskScheduler(substituteForSchedule, substituteForTask);
            var oneDay = new TimeSpan(1);
            taskbuilder.Every(oneDay);

            taskbuilder.TimeToRunTaskOccured();

            substituteForTask.Received().Run();
        }
示例#2
0
        public void Given_Task_Is_Scheduled_As_Repeating_When_Cache_Times_Out_Task_Is_Rescheduled()
        {
            var substituteForTask = Substitute.For<IVolatileTask>();
            var substituteForSchedule = Substitute.For<StubSchedule>();
            var taskbuilder = new StubTaskScheduler(substituteForSchedule, substituteForTask);
            var oneDay = new TimeSpan(1);
            taskbuilder.Every(oneDay);

            taskbuilder.TimeToRunTaskOccured();

            substituteForSchedule.Received().AddNextRun();
        }