Ejemplo n.º 1
0
        public void verify_basic_call_to_persister()
        {
            var aggregateId = GetAggregateId();

            _sut.Load(aggregateId, Int32.MaxValue, typeof(SampleAggregate));
            _persister.Received().Load(aggregateId, Int32.MaxValue, typeof(SampleAggregate).FullName);
        }
Ejemplo n.º 2
0
        public void verify_snapshot_wrong_version_gets_deleted()
        {
            var id       = new TestEventUnfolderId(1);
            var unfolder = new TestProjector();
            var memento  = (EventUnfolderMemento)unfolder.GetSnapshot();

            memento.Signature = "OTHER"; //change the version of the memento.
            Snapshot s = new Snapshot(id, 2, memento);

            _persister.Load("", 1, "").ReturnsForAnyArgs(s);
            sut.GetById <TestProjector, TestAggregateQueryModel>(id, 200);
            _persister.Received().Clear(id, memento.Version, typeof(TestProjector).Name);
        }
Ejemplo n.º 3
0
        public void verify_use_snapshot_strategy()
        {
            var id = new TestEventUnfolderId(Interlocked.Increment(ref progressive));

            using (var stream = _eventStore.OpenStream(id.AsString()))
            {
                CommitOneValue(stream, 42);
            }
            TestProjector.ShouldSnapshotReturn = true;
            sut.GetById <TestProjector, TestAggregateQueryModel>(id, Int32.MaxValue);
            TestProjector.ShouldSnapshotReturn = false;
            _persister.Received().Persist(Arg.Any <ISnapshot>(), Arg.Any <String>());
        }