Ejemplo n.º 1
0
        public void When_events_are_added_with_with_gaps_in_their_SequenceNumbers_then_they_are_assigned_the_next_sequential_value()
        {
            var events = new EventSequence(Guid.NewGuid());

            events.Add(new TestEvent { SequenceNumber = 22 });
            events.Add(new TestEvent { SequenceNumber = 33 });
            events.Add(new TestEvent());

            events.Last().SequenceNumber.Should().Be(34);
        }
Ejemplo n.º 2
0
        public void When_events_are_added_having_defined_SequenceNumbers_then_the_ids_are_maintained()
        {
            var events = new EventSequence(Guid.NewGuid());

            events.Add(new TestEvent { SequenceNumber = 3 });
            events.Add(new TestEvent { SequenceNumber = 2 });
            events.Add(new TestEvent { SequenceNumber = 1 });

            events.First().SequenceNumber.Should().Be(events.Last().SequenceNumber - 2);
        }
Ejemplo n.º 3
0
        public void When_events_are_added_without_defined_SequenceNumbers_then_they_are_assigned_the_next_sequential_value()
        {
            var events = new EventSequence(Guid.NewGuid());

            events.Add(new TestEvent {
                SequenceNumber = 2
            });
            events.Add(new TestEvent());
            events.Add(new TestEvent());

            events.Last().SequenceNumber.Should().Be(4);
        }
Ejemplo n.º 4
0
        public void When_events_are_added_having_defined_SequenceNumbers_then_the_ids_are_maintained()
        {
            var events = new EventSequence(Guid.NewGuid());

            events.Add(new TestEvent {
                SequenceNumber = 3
            });
            events.Add(new TestEvent {
                SequenceNumber = 2
            });
            events.Add(new TestEvent {
                SequenceNumber = 1
            });

            events.First().SequenceNumber.Should().Be(events.Last().SequenceNumber - 2);
        }