public void Resume_ServiceIsRunning_StatusIsNotChanged() { // 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(); var statusBeforeResume = messageQueueFeeder.GetStatus(); // Act messageQueueFeeder.Resume(); var statusAfterResume = messageQueueFeeder.GetStatus(); // Assert Assert.AreEqual(statusBeforeResume, statusAfterResume); } }
public void Resume_ServiceIsStopped_StatusIsStillStopped() { // 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(); messageQueueFeeder.Stop(); // Act messageQueueFeeder.Resume(); // Assert Assert.AreEqual(ServiceStatus.Stopped, messageQueueFeeder.GetStatus()); } }
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()); } }