public void ShouldAppendDomainEventsToEndOfStream()
            {
                TestAggregateRoot aggregateRoot = new TestAggregateRoot(Guid.NewGuid());
                IAggregateRoot    explicitCast  = aggregateRoot;

                // Apply 3 domain events.
                aggregateRoot.ChangeMe(Guid.NewGuid());
                aggregateRoot.ChangeMe(Guid.NewGuid());
                aggregateRoot.ChangeMe(Guid.NewGuid());

                DomainEventStream stream1 = (DomainEventStream)explicitCast.GetDomainEventsMarkedForCommit();

                // Clear domain events.
                explicitCast.MarkDomainEventsAsCommitted();

                // Apply 3 domain events.
                aggregateRoot.ChangeMe(Guid.NewGuid());
                aggregateRoot.ChangeMe(Guid.NewGuid());
                aggregateRoot.ChangeMe(Guid.NewGuid());

                DomainEventStream stream2 = (DomainEventStream)explicitCast.GetDomainEventsMarkedForCommit();

                // Append 2 streams.
                DomainEventStream result = stream1.AppendDomainEventStream(stream2);

                result.Should().HaveCount(6);
            }
            public void ShouldRemoveAllAppliedDomainEvents()
            {
                TestAggregateRoot aggregateRoot = new TestAggregateRoot(Guid.NewGuid());

                // Apply 3 domain events
                aggregateRoot.ChangeMe(Guid.NewGuid());
                aggregateRoot.ChangeMe(Guid.NewGuid());
                aggregateRoot.ChangeMe(Guid.NewGuid());

                // Check
                IAggregateRoot explicitCast = aggregateRoot;

                explicitCast.GetDomainEventsMarkedForCommit().Should().HaveCount(3);

                // Clear
                explicitCast.MarkDomainEventsAsCommitted();
                explicitCast.GetDomainEventsMarkedForCommit().Should().HaveCount(0);
            }