Inheritance: IOrchardShellEvents
        public void DoWorkShouldSendHeartbeatToTaskManager() {
            var taskManager = new Mock<IBackgroundService>();

            var builder = new ContainerBuilder();
            builder.RegisterInstance(taskManager.Object);
            var container = builder.Build();

            var heartbeatSource = new SweepGenerator(container);
            heartbeatSource.DoWork();
            taskManager.Verify(x => x.Sweep(), Times.Once());
        }
        public void ActivatedEventShouldStartTimer() {
            var taskManager = new Mock<IBackgroundService>();

            var builder = new ContainerBuilder();
            builder.RegisterInstance(taskManager.Object);
            var container = builder.Build();

            var heartbeatSource = new SweepGenerator(container) {
                Interval = TimeSpan.FromMilliseconds(25)
            };

            taskManager.Verify(x => x.Sweep(), Times.Never());
            heartbeatSource.Activated();
            System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(80));
            heartbeatSource.Terminating();
            taskManager.Verify(x => x.Sweep(), Times.AtLeastOnce());
        }