public void ReturnsUnitsResult() { IEnumerable<HundredGroup> numberGroups = new[] { new HundredGroup(0), new HundredGroup(0), new HundredGroup(1) }; var converters = GetConverters(); var resultsCalculator = new ResultsCalculator(numberGroups, converters, numberDescriber); AssertResultIs("one", resultsCalculator); }
public string Convert(int number) { var numberGroups = GetNumberGroups(number); var converters = GetConverters(numberGroups); var results = new ResultsCalculator(numberGroups, converters, numberDescriber).CalculateResults(); return string.Join(" ", results); }
public void JoinsThousandsToTensAndUnits() { IEnumerable<HundredGroup> numberGroups = new[] { new HundredGroup(0), new HundredGroup(1), new HundredGroup(1) }; var converters = GetConverters(); var resultsCalculator = new ResultsCalculator(numberGroups, converters, numberDescriber); var results = resultsCalculator.CalculateResults(); Assert.That(results.ElementAt(1), Is.EqualTo("and")); }
private static void AssertResultIs(string result, ResultsCalculator resultsCalculator) { var results = resultsCalculator.CalculateResults(); Assert.That(results.Count(), Is.EqualTo(1)); Assert.That(results.First(), Is.EqualTo(result)); }