Beispiel #1
0
    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());
    }
Beispiel #2
0
    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());
    }
Beispiel #3
0
    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());
    }
Beispiel #4
0
    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());
    }