Exemplo n.º 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);
 }
Exemplo n.º 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());
        }
Exemplo n.º 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());
        }
Exemplo n.º 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());
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 7
0
        public void Created_Aggregate_Has_Version_Zero()
        {
            TestAggregate agg = new TestAggregate();

            Assert.AreEqual(0, agg.AggregateVersion);
        }
Exemplo n.º 8
0
 public void Created_Aggregate_Has_Version_Zero()
 {
     TestAggregate agg = new TestAggregate();
     Assert.AreEqual(0, agg.AggregateVersion);
 }