public void Step_ParsesLineToCorrectStepsWithPrerequisiteAndNext(string line, char step1, char step2, StepSettings stepSettings) { var lines = new List <string> { line }; var steps = new StepFactory(stepSettings).Create(lines); Assert.Equal(2, steps.Count); Assert.Equal(step2, steps.First(x => x.Name == step1).NextSteps.First().Name); Assert.Empty(steps.First(x => x.Name == step2).NextSteps); Assert.Equal(step1, steps.First(x => x.Name == step2).PrerequisiteSteps.First().Name); Assert.Empty(steps.First(x => x.Name == step1).PrerequisiteSteps); }
public void Step_ParsesTwoLinesWithThreeSteps(StepSettings stepSettings) { var lines = new List <string> { "Step C must be finished before step A can begin.", "Step C must be finished before step F can begin.", }; var steps = new StepFactory(stepSettings).Create(lines); Assert.Equal(3, steps.Count); Assert.Contains(steps.First(x => x.Name == 'A').PrerequisiteSteps, x => x.Name == 'C'); Assert.Contains(steps.First(x => x.Name == 'F').PrerequisiteSteps, x => x.Name == 'C'); Assert.Contains(steps.First(x => x.Name == 'C').NextSteps, x => x.Name == 'A'); Assert.Contains(steps.First(x => x.Name == 'C').NextSteps, x => x.Name == 'F'); }
public void StepFactory_AllowsSettingDurationOffset(string line, char testedStep, int duration, int durationOffset, StepSettings stepSettings) { stepSettings.DurationOffset = durationOffset; var lines = new List <string> { line }; var steps = new StepFactory(stepSettings).Create(lines); Assert.Equal(duration, steps.First(x => x.Name == testedStep).Duration); }