public void VersionedSegmentRunner_Run_OneSegment_SegmentVersionHigherThanContextVersion_ReturnsNull()
        {
            var segment = new Mock <ISegment>();

            segment.Setup(s => s.Version).Returns(2);
            var pipelineContext = new Mock <IPipelineContext>();

            pipelineContext.Setup(c => c.MaxVersion).Returns(1);
            var runner = new VersionedSegmentRunner(new[] { segment.Object });

            var result = runner.Run(pipelineContext.Object);

            result.Should().BeNull();
        }
        public void VersionedSegmentRunner_Run_OneSegment_RunsTheSegment()
        {
            var runResult = new object();
            var segment   = new Mock <ISegment>();

            segment.Setup(s => s.Version).Returns(1);
            var pipelineContext = new Mock <IPipelineContext>();

            pipelineContext.Setup(c => c.MaxVersion).Returns(1);
            var segmentRunner = new Mock <ISegmentRunner>();

            segmentRunner.Setup(r => r.Run(pipelineContext.Object)).Returns(runResult);
            var segmentRunnerFactory = new Mock <ISegmentRunnerFactory>();

            segmentRunnerFactory.Setup(f => f.CreateSegmentRunner(segment.Object)).Returns(segmentRunner.Object);
            var runner = new VersionedSegmentRunner(new[] { segment.Object }, segmentRunnerFactory.Object);

            var result = runner.Run(pipelineContext.Object);

            result.Should().Be(runResult);
        }