public void When_Cache_Times_Out_Task_Is_Run()
        {
            var substituteForTask = Substitute.For<IVolatileTask>();
            var taskbuilder = new HttpCacheTaskScheduler(_substituteICache, _substituteForIClock, substituteForTask);

            taskbuilder.TimeToRunTaskOccured();

            substituteForTask.Received().Run();
        }
        public void Given_Task_Is_Scheduled_As_Repeating_When_Cache_Times_Out_Task_Is_Rescheduled()
        {
            var substituteForTask = Substitute.For<IVolatileTask>();
            var taskbuilder = new HttpCacheTaskScheduler(_substituteICache, _substituteForIClock, substituteForTask);
            var oneDay = new TimeSpan(1);
            taskbuilder.Every(oneDay);

            taskbuilder.TimeToRunTaskOccured();

            _substituteICache.Received(2).Add(Arg.Any<string>(),
                                Arg.Is<TimeSpan>(x => x == oneDay),
                                Arg.Is<CacheDependency>(x => x == null),
                                Arg.Is<DateTime>(x => x == _now.Add(oneDay)),
                                Arg.Is<TimeSpan>(x => x == Cache.NoSlidingExpiration),
                                Arg.Is<CacheItemPriority>(x => x == CacheItemPriority.NotRemovable),
                                Arg.Any<CacheItemRemovedCallback>());
        }