public async Task get_reads_last_event() { _store.Setup(x => x.GetEventsBackwards(Moq.It.IsAny <string>(), StreamPosition.End, Moq.It.IsAny <int?>())) .Returns(Task.FromResult(new[] { _fullevent.Object }.AsEnumerable())); var snapshot = await _snapshots.GetSnapshot <Entity>("test", "test", null).ConfigureAwait(false); Assert.NotNull(snapshot); Assert.AreEqual(new Id("test"), snapshot.Payload.EntityId); }
public async Task get_tries_cache_misses() { _snapshots = new Aggregates.Internal.StoreSnapshots(_store.Object, _cache.Object, (a, b, c, d, e) => "test"); _cache.Setup(x => x.Retreive("test")).Returns(Task.FromResult((ISnapshot)null)); var snapshot = await _snapshots.GetSnapshot <Entity>("test", "test", null).ConfigureAwait(false); Assert.Null(snapshot); }