コード例 #1
0
 public void Applying_Two_Events_Sets_Version_Two()
 {
     TestAggregate agg = new TestAggregate();
     agg.ApplyChange(new AggregateChanged());
     agg.ApplyChange(new AggregateChanged());
     Assert.AreEqual(2, agg.AggregateVersion);
 }
コード例 #2
0
        public void UncommittedEvents_Can_Be_Fetched()
        {
            TestAggregate agg = new TestAggregate();

            agg.Change();
            agg.Change();
            agg.Change();

            var uncommittedEvents = agg.UncommittedEvents();

            Assert.AreEqual(3, uncommittedEvents.Count());
        }
コード例 #3
0
        public void Cleared_Events_Are_Gone()
        {
            TestAggregate agg = new TestAggregate();
            agg.Change();
            agg.Change();
            agg.Change();
            agg.ClearUncommittedEvents();

            var uncommittedEvents = agg.UncommittedEvents();

            Assert.AreEqual(0, uncommittedEvents.Count());
        }
コード例 #4
0
        public void Cleared_Events_Are_Gone()
        {
            TestAggregate agg = new TestAggregate();

            agg.Change();
            agg.Change();
            agg.Change();
            agg.ClearUncommittedEvents();

            var uncommittedEvents = agg.UncommittedEvents();

            Assert.AreEqual(0, uncommittedEvents.Count());
        }
コード例 #5
0
        public void Loading_Event_Changes_The_State()
        {
            TestAggregate agg = new TestAggregate();

            var events = new List<Event>();
            events.Add(new AggregateChanged());
            events.Add(new AggregateChanged());
            events.Add(new AggregateChanged());
            events.Add(new AggregateChanged());

            agg.LoadHistory(events);

            Assert.AreEqual(4, agg.AggregateVersion);
        }
コード例 #6
0
        public void Loading_Event_Changes_The_State()
        {
            TestAggregate agg = new TestAggregate();

            var events = new List <Event>();

            events.Add(new AggregateChanged());
            events.Add(new AggregateChanged());
            events.Add(new AggregateChanged());
            events.Add(new AggregateChanged());

            agg.LoadHistory(events);

            Assert.AreEqual(4, agg.AggregateVersion);
        }
コード例 #7
0
        public void Created_Aggregate_Has_Version_Zero()
        {
            TestAggregate agg = new TestAggregate();

            Assert.AreEqual(0, agg.AggregateVersion);
        }
コード例 #8
0
 public void Created_Aggregate_Has_Version_Zero()
 {
     TestAggregate agg = new TestAggregate();
     Assert.AreEqual(0, agg.AggregateVersion);
 }