public void CommittingEvents_UpToVersion_WhenStreamIsTruncated_YieldsSomeCommittedEvents()
        {
            var stream = new AggregateEventStream<ServiceCaseId>();

            var e1 = new ServiceCase.CommunicationThreadStarted(1, ServiceCase.SampleContent.Topic, ServiceCase.SampleContent.TopicDescription, ServiceCase.SampleContent.ResponsibleParty, _id, 7);
            var e2 = new ServiceCase.CommunicationRecorded(1, CommunicationDirection.Incoming, ServiceCase.SampleContent.CommunicationContent, SystemClock.UtcNow, ServiceCase.SampleContent.CommunicationDuration, ServiceCase.SampleContent.ResponsibleParty, _id, 8);
            var e3 = new ServiceCase.CommunicationRecorded(1, CommunicationDirection.Incoming, ServiceCase.SampleContent.CommunicationContent, SystemClock.UtcNow, ServiceCase.SampleContent.CommunicationDuration, ServiceCase.SampleContent.ResponsibleParty, _id, 9);

            stream.AppendEvent(e1);
            stream.AppendEvent(e2);
            stream.AppendEvent(e3);

            stream.CommitEvents(8);

            stream.Events.Count().Should().Be(3);
            stream.UncommittedEvents.Count().Should().Be(1);
            stream.CommittedEvents.Count().Should().Be(2);

            stream.CommittedVersion.Should().Be(8);
            stream.Version.Should().Be(9);

            stream.CommittedEvents.ElementAt(0).Should().Be(e1);
            stream.CommittedEvents.ElementAt(1).Should().Be(e2);
            stream.UncommittedEvents.ElementAt(0).Should().Be(e3);
        }
        public void CommittingManyEvents_EventStreamsAndVersionCorrect()
        {
            var stream = new AggregateEventStream<ServiceCaseId>();

            var e2 = new ServiceCase.CommunicationThreadStarted(1, ServiceCase.SampleContent.Topic, ServiceCase.SampleContent.TopicDescription, ServiceCase.SampleContent.ResponsibleParty, _id, 2);
            var e3 = new ServiceCase.CommunicationRecorded(1, CommunicationDirection.Incoming, ServiceCase.SampleContent.CommunicationContent, SystemClock.UtcNow, ServiceCase.SampleContent.CommunicationDuration, ServiceCase.SampleContent.ResponsibleParty, _id, 3);

            stream.AppendEvent(_openedEvent);
            stream.AppendEvent(e2);
            stream.AppendEvent(e3);

            stream.CommitEvents();

            stream.Events.Count().Should().Be(3);
            stream.UncommittedEvents.Count().Should().Be(0);
            stream.CommittedEvents.Count().Should().Be(3);

            stream.CommittedVersion.Should().Be(3);
            stream.Version.Should().Be(3);

            stream.CommittedEvents.ElementAt(0).Should().Be(_openedEvent);
            stream.CommittedEvents.ElementAt(1).Should().Be(e2);
            stream.CommittedEvents.ElementAt(2).Should().Be(e3);
        }