예제 #1
0
        private string GetThousandsWord(ExpandedDigits expandedDigits)
        {
            if (expandedDigits.Thousands == 0 || expandedDigits.CanCompressFourDigitNumberIntoThreeDigitNotation())
            {
                return(NumberNotFound);
            }

            return(GetUnitsWord(expandedDigits.Thousands) + " thousand ");
        }
예제 #2
0
        public void CanCompressFourDigitNumberIntoThreeDigitNotation_WhenNotPossible_ShouldReturnFalse()
        {
            //---------------Arrange-------------------
            var sut = new ExpandedDigits
            {
                Thousands = 0,
                Hundreds  = 3,
                Tens      = 0,
                Units     = 0
            };
            //---------------Act----------------------
            var actual = sut.CanCompressFourDigitNumberIntoThreeDigitNotation();

            //---------------Assert-----------------------
            actual.Should().BeFalse();
        }
예제 #3
0
        private string GetHundredsWord(ExpandedDigits expandedDigits)
        {
            if (expandedDigits.Hundreds == 0)
            {
                return(NumberNotFound);
            }

            if (expandedDigits.CanCompressFourDigitNumberIntoThreeDigitNotation())
            {
                var compressedDigits = new ExpandedDigits {
                    Tens = expandedDigits.Thousands, Units = expandedDigits.Hundreds
                };
                var compressionResult = GetTensWord(compressedDigits) + GetUnitsWord(compressedDigits.Units);
                return(compressionResult + " hundred");
            }

            return(GetUnitsWord(expandedDigits.Hundreds) + " hundred ");
        }