public void SpecifiedAndTransitiveAndNoNormal() { // Given Engine engine = GetEngine(); // When IReadOnlyPipelineCollection executingPipelines = engine.GetExecutingPipelines(new[] { "E" }, false); // Then executingPipelines.Keys.ShouldBe(new[] { "A", "D", "E", "F" }, true); }
public void ZeroLengthAndNormal() { // Given Engine engine = GetEngine(); // When IReadOnlyPipelineCollection executingPipelines = engine.GetExecutingPipelines(Array.Empty <string>(), true); // Then executingPipelines.Keys.ShouldBe(new[] { "A", "D", "E", "F", "H" }, true); }
public void NullPipelinesAndNoNormal() { // Given Engine engine = GetEngine(); // When IReadOnlyPipelineCollection executingPipelines = engine.GetExecutingPipelines(null, false); // Then executingPipelines.Keys.ShouldBe(new[] { "F" }, true); }
public void NullPipelinesNormalAndNotDeployment() { // Given Engine engine = GetEngine(); // When IReadOnlyPipelineCollection executingPipelines = engine.GetExecutingPipelines(null, true); // Then executingPipelines.Keys.ShouldBe(new[] { "A", "D", "E", "F", "H" }, true); }
/// <summary> /// Gets all dependencies of this pipeline including <see cref="IReadOnlyPipeline.DependencyOf"/> declarations. /// </summary> /// <remarks>This does not resolve nested dependencies, only the combination of /// <see cref="IReadOnlyPipeline.Dependencies"/> and <see cref="IReadOnlyPipeline.DependencyOf"/> declarations.</remarks> /// <param name="pipeline">The pipeline.</param> /// <param name="pipelines">The current pipelines.</param> /// <returns>All dependencies of the pipeline.</returns> public static IEnumerable <string> GetAllDependencies(this IReadOnlyPipeline pipeline, IReadOnlyPipelineCollection pipelines) { _ = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _ = pipelines ?? throw new ArgumentNullException(nameof(pipelines)); string pipelineName = pipelines.FirstOrDefault(x => x.Value.Equals(pipeline)).Key ?? throw new InvalidOperationException($"Could not find pipeline {pipeline.GetType().Name} in pipeline collection"); return((pipeline.Dependencies ?? (IEnumerable <string>)Array.Empty <string>()) .Concat(pipelines.Where(x => x.Value.DependencyOf?.Contains(pipelineName, StringComparer.OrdinalIgnoreCase) == true).Select(x => x.Key)) .Distinct(StringComparer.OrdinalIgnoreCase)); }