public void Resume_ServiceIsPaused_StatusIsChangedToRunning()
        {
            // Arrange
            var systemInformationSender = new Mock <ISystemInformationSender>();
            var workQueue = new Mock <IMessageQueue <SystemInformation> >();

            workQueue.Setup(w => w.Dequeue()).Returns(new SystemInformationQueueItem(new SystemInformation()));

            var errorQueue = new Mock <IMessageQueue <SystemInformation> >();

            using (var messageQueueWorker = new SystemInformationMessageQueueWorker(systemInformationSender.Object, workQueue.Object, errorQueue.Object))
            {
                var workerTaks = new Task(messageQueueWorker.Start);
                workerTaks.Start();

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

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

                // Assert
                Assert.AreEqual(ServiceStatus.Running, messageQueueWorker.GetStatus());
            }
        }
        public void Resume_ServiceIsRunning_StatusIsNotChanged()
        {
            // Arrange
            var systemInformationSender = new Mock <ISystemInformationSender>();
            var workQueue = new Mock <IMessageQueue <SystemInformation> >();

            workQueue.Setup(w => w.Dequeue()).Returns(new SystemInformationQueueItem(new SystemInformation()));

            var errorQueue = new Mock <IMessageQueue <SystemInformation> >();

            using (var messageQueueWorker = new SystemInformationMessageQueueWorker(systemInformationSender.Object, workQueue.Object, errorQueue.Object))
            {
                var workerTaks = new Task(messageQueueWorker.Start);
                workerTaks.Start();

                Thread.Sleep(500);

                var statusBeforeResume = messageQueueWorker.GetStatus();

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

                var statusAfterResume = messageQueueWorker.GetStatus();

                // Assert
                Assert.AreEqual(statusBeforeResume, statusAfterResume);
            }
        }
        public void Resume_ServiceIsStopped_StatusIsStillStopped()
        {
            // Arrange
            var systemInformationSender = new Mock <ISystemInformationSender>();
            var workQueue = new Mock <IMessageQueue <SystemInformation> >();

            workQueue.Setup(w => w.Dequeue()).Returns(new SystemInformationQueueItem(new SystemInformation()));

            var errorQueue = new Mock <IMessageQueue <SystemInformation> >();

            using (var messageQueueWorker = new SystemInformationMessageQueueWorker(systemInformationSender.Object, workQueue.Object, errorQueue.Object))
            {
                // Act
                messageQueueWorker.Resume();

                // Assert
                Assert.AreEqual(ServiceStatus.Stopped, messageQueueWorker.GetStatus());
            }
        }