Example #1
0
            public void ThrowsForNonExistingPipeline()
            {
                // Given
                TestDocument a1 = new TestDocument("a1");
                TestDocument b1 = new TestDocument("b1");
                TestDocument b2 = new TestDocument("b2");
                TestDocument c1 = new TestDocument("c1");
                TestDocument d1 = new TestDocument("d1");
                TestDocument d2 = new TestDocument("d2");
                ConcurrentDictionary <string, PhaseResult[]> phaseResults =
                    new ConcurrentDictionary <string, PhaseResult[]>(StringComparer.OrdinalIgnoreCase);
                IPipelineCollection pipelines = new TestPipelineCollection();
                PipelinePhase       phaseA    =
                    GetPipelineAndPhase("A", Phase.Process, pipelines, phaseResults, new[] { a1 });
                PipelinePhase phaseB =
                    GetPipelineAndPhase("B", Phase.Process, pipelines, phaseResults, new[] { b1, b2 }, phaseA);
                PipelinePhase phaseC =
                    GetPipelineAndPhase("C", Phase.Process, pipelines, phaseResults, new[] { c1 }, phaseB);
                PipelinePhase phaseD =
                    GetPipelineAndPhase("D", Phase.Process, pipelines, phaseResults, new[] { d1, d2 });
                PhaseOutputs documentCollection = new PhaseOutputs(phaseResults, phaseC, pipelines);

                // When, Then
                Should.Throw <KeyNotFoundException>(() => documentCollection.FromPipeline("E"));
            }
            public void GetsDocumentsForTransientDependentPipelineDuringProcessPhase()
            {
                // Given
                TestDocument a1 = new TestDocument("a1");
                TestDocument b1 = new TestDocument("b1");
                TestDocument b2 = new TestDocument("b2");
                TestDocument c1 = new TestDocument("c1");
                TestDocument d1 = new TestDocument("d1");
                TestDocument d2 = new TestDocument("d2");
                ConcurrentDictionary <string, PhaseResult[]> phaseResults =
                    new ConcurrentDictionary <string, PhaseResult[]>(StringComparer.OrdinalIgnoreCase);
                IPipelineCollection pipelines = new TestPipelineCollection();
                PipelinePhase       phaseA    =
                    GetPipelineAndPhase("A", Phase.Process, pipelines, phaseResults, new[] { a1 });
                PipelinePhase phaseB =
                    GetPipelineAndPhase("B", Phase.Process, pipelines, phaseResults, new[] { b1, b2 }, phaseA);
                PipelinePhase phaseC =
                    GetPipelineAndPhase("C", Phase.Process, pipelines, phaseResults, new[] { c1 }, phaseB);
                PipelinePhase phaseD =
                    GetPipelineAndPhase("D", Phase.Process, pipelines, phaseResults, new[] { d1, d2 });
                PhaseOutputs documentCollection = new PhaseOutputs(phaseResults, phaseC, pipelines);

                // When
                IDocument[] result = documentCollection.FromPipeline("A").ToArray();

                // Then
                result.ShouldBe(new[] { a1 });
            }
Example #3
0
            public void DoesNotThrowForCurrentPipelineDuringTransform()
            {
                // Given
                ConcurrentDictionary <string, PhaseResult[]> phaseResults =
                    new ConcurrentDictionary <string, PhaseResult[]>(StringComparer.OrdinalIgnoreCase);
                IPipelineCollection pipelines          = new TestPipelineCollection();
                PipelinePhase       phase              = GetPipelineAndPhase("A", Phase.Transform, pipelines, phaseResults, Array.Empty <IDocument>());
                PhaseOutputs        documentCollection = new PhaseOutputs(phaseResults, phase, pipelines);

                // When, Then
                Should.NotThrow(() => documentCollection.FromPipeline("A"));
            }
Example #4
0
            public void ThrowsForCurrentPipelineDuringProcess()
            {
                // Given
                ConcurrentDictionary <string, PhaseResult[]> phaseResults =
                    new ConcurrentDictionary <string, PhaseResult[]>(StringComparer.OrdinalIgnoreCase);
                IPipelineCollection pipelines          = new TestPipelineCollection();
                PipelinePhase       phase              = GetPipelineAndPhase("A", Phase.Process, pipelines, phaseResults, Array.Empty <IDocument>());
                PhaseOutputs        documentCollection = new PhaseOutputs(phaseResults, phase, pipelines);

                // When, Then
                Should.Throw <InvalidOperationException>(() => documentCollection.FromPipeline("A"));
            }
Example #5
0
            public void ThrowsForNullPipeline()
            {
                // Given
                ConcurrentDictionary <string, PhaseResult[]> phaseResults =
                    new ConcurrentDictionary <string, PhaseResult[]>(StringComparer.OrdinalIgnoreCase);
                IPipelineCollection pipelines          = new TestPipelineCollection();
                PipelinePhase       phase              = GetPipelineAndPhase("A", Phase.Transform, pipelines, phaseResults, Array.Empty <IDocument>());
                PhaseOutputs        documentCollection = new PhaseOutputs(phaseResults, phase, pipelines);

                // When, Then
                Should.Throw <ArgumentException>(() => documentCollection.FromPipeline(null));
            }
            public void GetsDocumentsForInputPhaseDuringTransformPhase()
            {
                // Given
                TestDocument a1 = new TestDocument("a1");
                TestDocument a2 = new TestDocument("a2");
                TestDocument b1 = new TestDocument("b1");
                TestDocument b2 = new TestDocument("b2");
                ConcurrentDictionary <string, PhaseResult[]> phaseResults =
                    new ConcurrentDictionary <string, PhaseResult[]>(StringComparer.OrdinalIgnoreCase);
                IPipelineCollection pipelines = new TestPipelineCollection();
                PipelinePhase       phaseA    =
                    GetPipelineAndPhase("A", Phase.PostProcess, pipelines, phaseResults, new[] { a1, a2 }, Phase.Input);
                PipelinePhase phaseB =
                    GetPipelineAndPhase("B", Phase.PostProcess, pipelines, phaseResults, new[] { b1, b2 }, phaseA);
                PhaseOutputs documentCollection = new PhaseOutputs(phaseResults, phaseB, pipelines);

                // When
                IDocument[] result = documentCollection.FromPipeline("A").ToArray();

                // Then
                result.ShouldBe(new[] { a1, a2 });
            }