Exemplo n.º 1
0
 public void Setup()
 {
     _testRep = new TestRepository();
     _rep = new CacheRepository(_testRep, new TestInMemoryEventStore());
     _aggregate = _testRep.Get<TestAggregate>(Guid.NewGuid());
     _aggregate.DoSomething();
     _rep.Save(_aggregate,-1);
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 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));
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        public void Setup()
        {
            _eventStore = new TestInMemoryEventStore();
            _rep = new Repository(_eventStore);
            _session = new Session(_rep);

            _aggregate = new TestAggregate(Guid.NewGuid());
            _aggregate.DoSomething();
            _rep.Save(_aggregate);
        }
Exemplo n.º 6
0
 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) { }
 }