public void Sort_ThrowsCircularReferenceExceptionFor3StageCircularReference() { var buildSteps = new IBuildStep[] { new Circular1(), new Circular2(), new Circular3() }; var sut = new BuildStepDependencySorter(); Assert.Throws<CircularDependencyException>(() => sut.Sort(buildSteps)); }
public void Sort_ResolvesASimpleDepdency() { var buildSteps = new IBuildStep[] { new BuildStepA(), new BuildStepB() }; var sut = new BuildStepDependencySorter(); var result = sut.Sort(buildSteps).ToArray(); result[0].Should().BeOfType<BuildStepB>(); result[1].Should().BeOfType<BuildStepA>(); }
public void Sort_ResolvesMultipleDependencies() { var buildSteps = new IBuildStep[] { new MultipleDepdencyStepC(), new MultipleDepdencyStepB(), new MultipleDepdencyStepA() }; var sut = new BuildStepDependencySorter(); var result = sut.Sort(buildSteps).ToArray(); Assert.IsTrue((result[0].GetType() == typeof(MultipleDepdencyStepA) && result[1].GetType() == typeof(MultipleDepdencyStepB)) || (result[1].GetType() == typeof(MultipleDepdencyStepA) && result[0].GetType() == typeof(MultipleDepdencyStepB))); result[2].Should().BeOfType<MultipleDepdencyStepC>(); }
public void Sort_ResolvesASequentialDepdency() { var buildSteps = new IBuildStep[] { new SequentialDepdencyStepD(), new SequentialDepdencyStepC(), new SequentialDepdencyStepB(), new SequentialDepdencyStepA() }; var sut = new BuildStepDependencySorter(); var result = sut.Sort(buildSteps).ToArray(); result[0].Should().BeOfType<SequentialDepdencyStepA>(); result[1].Should().BeOfType<SequentialDepdencyStepB>(); result[2].Should().BeOfType<SequentialDepdencyStepC>(); result[3].Should().BeOfType<SequentialDepdencyStepD>(); }