예제 #1
0
        public void Taking_uncommitted_events_with_applied_one_uncommitted_event_returns_1()
        {
            var sut = new FakeAggregate();

            sut.BussinesOperation();
            Assert.Equal(1, sut.TakeUncommittedEvents().Length);
        }
예제 #2
0
        public void Taking_snapshot_from_aggregate_with_applied_one_uncommitted_event_returns_that_event_was_applied()
        {
            var sut = new FakeAggregate();

            sut.BussinesOperation();
            var snapshot = (FakeAggregateState)sut.GetSnapshot().State;

            Assert.True(snapshot.FakeEventApplied);
        }
예제 #3
0
        public void Restored_aggregate_with_snapshot_version_5_and_2_events_and_applied_one_uncommitted_event_returns_committed_version_equals_7()
        {
            var sut    = new FakeAggregate();
            var events = new List <IEvent>
            {
                new RestoredMemento(5, new FakeAggregateState()),
                new FakeEvent(),
                new FakeEvent()
            }.ToArray();

            sut.Restore(SequentialGuid.NewGuid(), events);
            sut.BussinesOperation();
            Assert.Equal(7, sut.CommittedVersion);
        }