public void time_out_cannot_be_complete_if_operation_has_not_timed_out() { var operation = new RecoveryOperation(LiveProducer, _recoveryRequestIssuerMock.Object, new[] { MessageInterest.AllMessages }, 0, false); operation.Start(); operation.CompleteTimedOut(); }
public void TimeOutCannotBeCompleteIfOperationHasNotTimedOut() { var operation = new RecoveryOperation(_liveProducer, _recoveryRequestIssuerMock.Object, new[] { MessageInterest.AllMessages }, 0, false); operation.Start(); var result = operation.CompleteTimedOut(); Assert.IsTrue(operation.IsRunning); Assert.IsFalse(operation.HasTimedOut()); Assert.IsNull(result); }
public void time_out_cannot_be_complete_if_operation_has_not_timed_out() { var operation = new RecoveryOperation(LiveProducer, _recoveryRequestIssuerMock.Object, new[] { MessageInterest.AllMessages }, 0, false); operation.Start(); var result = operation.CompleteTimedOut(); Assert.IsTrue(operation.IsRunning); Assert.IsFalse(operation.HasTimedOut()); Assert.IsNull(result); }
public void values_after_time_out_are_correct() { var operation = new RecoveryOperation(LiveProducer, _recoveryRequestIssuerMock.Object, new[] { MessageInterest.AllMessages }, 0, false); operation.Start(); var startTime = _timeProvider.Now; _timeProvider.AddSeconds(LiveProducer.MaxRecoveryTime + 1); Assert.IsTrue(operation.HasTimedOut()); var result = operation.CompleteTimedOut(); Assert.IsNotNull(result); Assert.IsFalse(result.Success); Assert.AreEqual(result.RequestId, 1); Assert.AreEqual(result.InterruptedAt, null); Assert.AreEqual(result.StartTime, startTime); Assert.IsTrue(result.TimedOut); Assert.IsFalse(operation.IsRunning); Assert.IsNull(operation.RequestId); }
public void OperationCanBeReused() { var operation = new RecoveryOperation(_liveProducer, _recoveryRequestIssuerMock.Object, new[] { MessageInterest.LiveMessagesOnly }, 0, false); operation.Start(); _timeProvider.AddSeconds(60); Assert.IsTrue(operation.TryComplete(MessageInterest.LiveMessagesOnly, out _)); _timeProvider.AddSeconds(1800); operation.Start(); _timeProvider.AddSeconds(120); Assert.IsTrue(operation.TryComplete(MessageInterest.LiveMessagesOnly, out _)); operation.Start(); _timeProvider.AddSeconds(_liveProducer.MaxRecoveryTime + 1); Assert.IsTrue(operation.HasTimedOut()); Assert.IsNotNull(operation.CompleteTimedOut()); _timeProvider.AddSeconds(10); operation.Start(); Assert.IsTrue(operation.TryComplete(MessageInterest.LiveMessagesOnly, out _)); }