public void ThreeSteps_SecondStepReturnsFailedStepResult_DoesntRunThirdStep() { var stepOneCount = 0; var stepTwoCount = 0; var stepThreeCount = 0; var stepper = new Stepper(); stepper .AddFirstStep(() => { stepOneCount++; return(StepResult.Success(1)); }) .Then(test => { stepTwoCount++; if (false) { return(StepResult.Success(2)); } return(StepResult.Failure()); }) .Then(test => { stepThreeCount++; return(StepResult.Success(1)); }); stepper.RunJob(); Assert.AreEqual(1, stepOneCount); Assert.AreEqual(1, stepTwoCount); Assert.AreEqual(0, stepThreeCount); }
public void OneStep_HasBothSuccessAndFailStepResult_DoesntThrowException() { var stepper = new Stepper(); stepper.AddFirstStep(() => { if (true) { return(StepResult.Success(1)); } return(StepResult.Failure()); }) .Then(test => { Console.WriteLine(test); return(StepResult.Success()); }); var jobResult = stepper.RunJob(); Assert.AreEqual(false, jobResult.HasFailed); }