public void Setup()
 {
     _testRep = new TestRepository();
     _rep = new CacheRepository(_testRep, new TestInMemoryEventStore());
     _aggregate = _testRep.Get<TestAggregate>(Guid.NewGuid());
     _aggregate.DoSomething();
     _rep.Save(_aggregate,-1);
 }
 public When_saving_aggregate()
 {
     _testRep = new TestRepository();
     _rep = new CacheRepository(_testRep, new TestInMemoryEventStore(), new CqrsMemoryCache());
     _aggregate = _testRep.Get<TestAggregate>(Guid.NewGuid());
     _aggregate.DoSomething();
     _rep.Save(_aggregate, -1);
 }
Exemple #3
0
        public void Should_clear_tracked_aggregates()
        {
            var agg = new TestAggregate(Guid.NewGuid());
            _session.Add(agg);
            agg.DoSomething();
            _session.Commit();
            _eventStore.Events.Clear();

            Assert.Throws<AggregateNotFoundException>(() => _session.Get<TestAggregate>(agg.Id));
        }
        public When_saving_stale_data()
        {
            _eventStore = new TestInMemoryEventStore();
            _rep = new Repository(_eventStore);
            _session = new Session(_rep);

            _aggregate = new TestAggregate(Guid.NewGuid());
            _aggregate.DoSomething();
            _rep.Save(_aggregate);
        }
        public void Setup()
        {
            _eventStore = new TestInMemoryEventStore();
            _rep = new Repository(_eventStore);
            _session = new Session(_rep);

            _aggregate = new TestAggregate(Guid.NewGuid());
            _aggregate.DoSomething();
            _rep.Save(_aggregate);
        }
 public When_saving_fails()
 {
     _memoryCache = new MemoryCache();
     _testRep = new TestRepository();
     _rep = new CacheRepository(_testRep, new TestInMemoryEventStore(), _memoryCache);
     _aggregate = _testRep.Get<TestAggregate>(Guid.NewGuid());
     _aggregate.DoSomething();
     try
     {
         _rep.Save(_aggregate, 100);
     }
     catch (Exception) { }
 }