/// <summary> /// Constructor. /// </summary> /// <param name="delimiterParser">An object to parse delimiters.</param> /// <param name="numberLinesParser">An object to parse lines of delimited numbers</param> /// <param name="numbersParser">An object to parse numbers from a line</param> /// <param name="numberFilter">An object used to filter out unwanted numbers</param> /// <param name="numberDetector">An object used to detect invalid numbers</param> /// <param name="numberAdder">An object used to sum a list of numbers</param> public BasicStringCalculator(IDelimiterParser delimiterParser, INumberLinesParser numberLinesParser, INumbersParser numbersParser, INumberFilter numberFilter, INumberDetector numberDetector, INumberAdder numberAdder) { if (delimiterParser == null) { throw new ArgumentNullException(nameof(delimiterParser)); } if (numberLinesParser == null) { throw new ArgumentNullException(nameof(numberLinesParser)); } if (numbersParser == null) { throw new ArgumentNullException(nameof(numbersParser)); } if (numberFilter == null) { throw new ArgumentNullException(nameof(numberFilter)); } if (numberDetector == null) { throw new ArgumentNullException(nameof(numberDetector)); } if (numberAdder == null) { throw new ArgumentNullException(nameof(numberAdder)); } _delimiterParser = delimiterParser; _numberLinesParser = numberLinesParser; _numbersParser = numbersParser; _numberFilter = numberFilter; _numberDetector = numberDetector; _numberAdder = numberAdder; }
public TestThisClass(INumberAdder adderStrategy) { _adder = adderStrategy; }