public async System.Threading.Tasks.Task NoNeedsWorkRepros() { _mockReproOperations.Setup(x => x.SearchStates(VmStateHelper.NeedsWork)) .Returns(AsyncEnumerable.Empty <Repro>()); _mockCtx.Setup(x => x.ReproOperations) .Returns(_mockReproOperations.Object); var timerRepro = new TimerRepro(_log, _mockCtx.Object); await timerRepro.Run(new TimerInfo()); _mockReproOperations.Verify(x => x.ProcessStateUpdates(It.IsAny <Repro>(), It.IsAny <int>()), Times.Never()); }
public async System.Threading.Tasks.Task NoExpiredRepros() { _mockReproOperations.Setup(x => x.SearchExpired()) .Returns(AsyncEnumerable.Empty <Repro>()); _mockCtx.Setup(x => x.ReproOperations) .Returns(_mockReproOperations.Object); var timerRepro = new TimerRepro(_log, _mockCtx.Object); await timerRepro.Run(new TimerInfo()); _mockReproOperations.Verify(x => x.Stopping(It.IsAny <Repro>()), Times.Never()); }
public async System.Threading.Tasks.Task ExpiredRepro() { _mockReproOperations.Setup(x => x.SearchExpired()) .Returns(new List <Repro> { GenerateRepro() }.ToAsyncEnumerable()); _mockCtx.Setup(x => x.ReproOperations) .Returns(_mockReproOperations.Object); var timerRepro = new TimerRepro(_log, _mockCtx.Object); await timerRepro.Run(new TimerInfo()); _mockReproOperations.Verify(x => x.Stopping(It.IsAny <Repro>()), Times.Once()); }
public async System.Threading.Tasks.Task DontProcessExpiredVms() { var expiredVm = GenerateRepro(); var notExpiredVm = GenerateRepro(); _mockReproOperations.Setup(x => x.SearchExpired()) .Returns(new List <Repro> { expiredVm }.ToAsyncEnumerable()); _mockReproOperations.Setup(x => x.SearchStates(VmStateHelper.NeedsWork)) .Returns(new List <Repro> { expiredVm, notExpiredVm }.ToAsyncEnumerable()); _mockCtx.Setup(x => x.ReproOperations) .Returns(_mockReproOperations.Object); var timerRepro = new TimerRepro(_log, _mockCtx.Object); await timerRepro.Run(new TimerInfo()); _mockReproOperations.Verify(x => x.ProcessStateUpdates(It.IsAny <Repro>(), It.IsAny <int>()), Times.Once()); }