public void NextScheduledTimeoutResetToDateTimeMinvalue() { var cache = new SagaTimeoutCache(new Mock <IStoreSagas>().Object, TimeSpan.FromMinutes(1)); cache.Clear(); Assert.Equal(DateTime.MinValue, cache.GetNextScheduledTimeout()); }
public void ReturnNextScheduledTimeoutIfCacheHasItems() { var now = DateTime.UtcNow; var nextTimeout = now.AddMinutes(1); var sagaStore = new Mock <IStoreSagas>(); var cache = new SagaTimeoutCache(sagaStore.Object, TimeSpan.FromMinutes(10)); SystemTime.OverrideWith(() => now); sagaStore.Setup(mock => mock.GetScheduledTimeouts(It.IsAny <DateTime>())).Returns(new[] { new SagaTimeout(typeof(Saga), GuidStrategy.NewGuid(), nextTimeout), new SagaTimeout(typeof(Saga), GuidStrategy.NewGuid(), nextTimeout.AddMinutes(5)) }); //NOTE: Because we are using an overriden SystemTime; the get will not actually clear out the cached items. Assert.Equal(0, cache.GetElapsedTimeouts().Count()); Assert.Equal(nextTimeout, cache.GetNextScheduledTimeout()); }
public void ReturnNextScheduledTimeoutIfCacheHasItems() { var now = DateTime.UtcNow; var nextTimeout = now.AddMinutes(1); var sagaStore = new Mock<IStoreSagas>(); var cache = new SagaTimeoutCache(sagaStore.Object, TimeSpan.FromMinutes(10)); SystemTime.OverrideWith(() => now); sagaStore.Setup(mock => mock.GetScheduledTimeouts(It.IsAny<DateTime>())).Returns(new[] { new SagaTimeout(typeof(Saga), GuidStrategy.NewGuid(), nextTimeout), new SagaTimeout(typeof(Saga), GuidStrategy.NewGuid(), nextTimeout.AddMinutes(5)) }); //NOTE: Because we are using an overriden SystemTime; the get will not actually clear out the cached items. Assert.Equal(0, cache.GetElapsedTimeouts().Count()); Assert.Equal(nextTimeout, cache.GetNextScheduledTimeout()); }
public void ReturnDateTimeMinValIfCacheEmpty() { var cache = new SagaTimeoutCache(new Mock <IStoreSagas>().Object, TimeSpan.FromMinutes(1)); Assert.Equal(DateTime.MinValue, cache.GetNextScheduledTimeout()); }
public void ReturnDateTimeMinValIfCacheEmpty() { var cache = new SagaTimeoutCache(new Mock<IStoreSagas>().Object, TimeSpan.FromMinutes(1)); Assert.Equal(DateTime.MinValue, cache.GetNextScheduledTimeout()); }
public void NextScheduledTimeoutResetToDateTimeMinvalue() { var cache = new SagaTimeoutCache(new Mock<IStoreSagas>().Object, TimeSpan.FromMinutes(1)); cache.Clear(); Assert.Equal(DateTime.MinValue, cache.GetNextScheduledTimeout()); }