private string ResultFor(HundredGroup numberGroup, ConversionStrategy converter, int position) { var result = converter.Convert(numberGroup); var postfix = numberDescriber.LookupPositionalName(position).Description; var shouldPostfixResult = result.Length > 0 && postfix.Length > 0; return shouldPostfixResult ? string.Format("{0} {1}", result, postfix) : result; }
public void HundredsTensAndUnitsAreZero() { var hundredGroup = new HundredGroup(0); Assert.That(hundredGroup.Hundreds, Is.EqualTo(0)); Assert.That(hundredGroup.Tens, Is.EqualTo(0)); Assert.That(hundredGroup.Units, Is.EqualTo(0)); }
private static bool RequiresConjunction(HundredGroup lastGroup) { return lastGroup.Hundreds==0 && lastGroup.Number>0; }
public void UnitsAreOne() { var hundredGroup = new HundredGroup(321); Assert.That(hundredGroup.Units, Is.EqualTo(1)); }
public void TensAreTen() { var hundredGroup = new HundredGroup(610); Assert.That(hundredGroup.Tens, Is.EqualTo(10)); }
public void HundredsAreOneHundred() { var hundredGroup = new HundredGroup(147); Assert.That(hundredGroup.Hundreds, Is.EqualTo(100)); }
public void ReturnsTensAndUnitsStrategy() { var hundredGroup = new HundredGroup(25); Assert.That(Factory.CreateConversionStrategy(hundredGroup), Is.TypeOf<TensAndUnitsConversionStrategy>()); }
public void ReturnsHundredsStrategy() { var hundredGroup = new HundredGroup(100); Assert.That(Factory.CreateConversionStrategy(hundredGroup), Is.TypeOf<HundredsConversionStrategy>()); }