public static NumberPipelineResult IfNotContainsAppendValue(this NumberPipelineResult currentValue, string possibleValueToAdd) => currentValue.NumberOrTextResult.Contains(possibleValueToAdd) ? currentValue : new NumberPipelineResult { Input = currentValue.Input, NumberOrTextResult = $"{currentValue.NumberOrTextResult}{possibleValueToAdd}" };
public override string HandleNumber(NumberPipelineResult input) => input.ContainsValue(5, () => input.IfNotContainsAppendValue("Buzz")) .ManageHandler(NextHandler);
public static string GetNumberPipelineResult(this NumberPipelineResult s) => string.IsNullOrEmpty(s.NumberOrTextResult) ? s.Input.ToString() : s.NumberOrTextResult;
public static string ManageHandler(this NumberPipelineResult s, IHandler nextHandler) => nextHandler.HandleNumber(s);
public static NumberPipelineResult ContainsValue(this NumberPipelineResult s, int value, Func <NumberPipelineResult> f) { return(!s.Input.ContainsNumber(value) ? s : f()); }
public static NumberPipelineResult VerifyIsDivisible(this NumberPipelineResult s, int divisor, Func <NumberPipelineResult> f) { return(!s.Input.IsDivisible(divisor) ? s : f()); }
public override string HandleNumber(NumberPipelineResult input) => input.VerifyIsDivisible(3, () => input.IfNotContainsPrependValue("Fizz")) .ManageHandler(NextHandler);