コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }