public void Pause_ServiceIsRunning_StatusIsChangedToPaused()
        {
            // Arrange
            int durationInMilliseconds = SystemInformationMessageQueueFeeder.SendIntervalInMilliseconds * 3;

            var systemInformationProvider = new Mock<ISystemInformationProvider>();
            var workQueue = new Mock<IMessageQueue<SystemInformation>>();

            using (var messageQueueFeeder = new SystemInformationMessageQueueFeeder(systemInformationProvider.Object, workQueue.Object))
            {
                var messageQueueFeederTask = new Task(messageQueueFeeder.Start);
                messageQueueFeederTask.Start();
                Thread.Sleep(durationInMilliseconds);

                // Act
                messageQueueFeeder.Pause();
                var statusAfterPause = messageQueueFeeder.GetStatus();

                // Assert
                Assert.AreEqual(ServiceStatus.Paused, statusAfterPause);
            }
        }
        public void Resume_ServiceIsPaused_StatusIsChangedToRunning()
        {
            // Arrange
            var systemInformationProvider = new Mock<ISystemInformationProvider>();
            var workQueue = new Mock<IMessageQueue<SystemInformation>>();

            using (var messageQueueFeeder = new SystemInformationMessageQueueFeeder(systemInformationProvider.Object, workQueue.Object))
            {
                var messageQueueFeederTask = new Task(messageQueueFeeder.Start);
                messageQueueFeederTask.Start();

                Thread.Sleep(500);
                messageQueueFeeder.Pause();

                // Act
                Thread.Sleep(500);
                messageQueueFeeder.Resume();

                // Assert
                Assert.AreEqual(ServiceStatus.Running, messageQueueFeeder.GetStatus());
            }
        }
        public void Pause_RunFor3Intervals_Pause_SystemInfoIsPulledAtMostTwoTimes()
        {
            // Arrange
            int durationInMilliseconds = SystemInformationMessageQueueFeeder.SendIntervalInMilliseconds * 3;

            var systemInformationProvider = new Mock<ISystemInformationProvider>();
            var workQueue = new Mock<IMessageQueue<SystemInformation>>();

            using (var messageQueueFeeder = new SystemInformationMessageQueueFeeder(systemInformationProvider.Object, workQueue.Object))
            {
                // Act
                var messageQueueFeederTask = new Task(messageQueueFeeder.Start);

                messageQueueFeederTask.Start();
                Thread.Sleep(durationInMilliseconds);

                messageQueueFeeder.Pause();
                Thread.Sleep(durationInMilliseconds);

                // Assert
                systemInformationProvider.Verify(s => s.GetSystemInfo(), Times.AtMost(3));
            }
        }