public void LoadsEvents()
        {
            Save("(H)aggrid", 0);

            var cache   = new CachingEventStoreDecorator(_store);
            var results = cache.Load("(H)aggrid").ToList();

            Assert.AreEqual(DataForSeq(0), results[0].Data);
            Assert.AreEqual(results, _store.CacheMisses);
        }
        public void LoadsFromCache()
        {
            Save("(H)aggrid", 0);
            Save("(H)aggrid", 1);
            Save("(H)aggrid", 2);

            var cache = new CachingEventStoreDecorator(_store);
            var _     = cache.Load("(H)aggrid").ToList();

            _store.CacheMisses.Clear();

            var results = cache.Load("(H)aggrid").ToList();

            Assert.AreEqual(DataForSeq(0), results[0].Data);
            Assert.AreEqual(DataForSeq(1), results[1].Data);
            Assert.AreEqual(DataForSeq(2), results[2].Data);
            Assert.AreEqual(0, _store.CacheMisses.Count);
        }
예제 #3
0
 public CachedEventStoreFactory()
 {
     _cachingEventStore = new CachingEventStoreDecorator(new MongoDbEventStore(MongoHelper.InitializeTestDatabase(), "events"));
 }