示例#1
0
        private string GetGatedUnitWord(ExpandedDigits digits)
        {
            if (digits.IsTeenNumber() || MultiDigitNumberEndingWithZero(digits))
            {
                return(NumberNotFound);
            }

            return(GetUnitsWord(digits.Units));
        }
        public void IsTeenNumber_WhenIs20_ShouldReturnFalse()
        {
            //---------------Arrange-------------------
            var sut = new ExpandedDigits
            {
                Tens  = 2,
                Units = 0
            };
            //---------------Act----------------------
            var actual = sut.IsTeenNumber();

            //---------------Assert-----------------------
            actual.Should().BeFalse();
        }
        public void IsTeenNumber_WhenIs11Through19_ShouldReturnTrue(int tens, int units)
        {
            //---------------Arrange-------------------
            var sut = new ExpandedDigits
            {
                Tens  = tens,
                Units = units
            };
            //---------------Act----------------------
            var actual = sut.IsTeenNumber();

            //---------------Assert-----------------------
            actual.Should().BeTrue();
        }
示例#4
0
        private string GetTensWord(ExpandedDigits digits)
        {
            if (digits.Tens == 0)
            {
                return(NumberNotFound);
            }

            if (digits.IsTeenNumber())
            {
                return(GetTeenNumberWord(digits));
            }

            return(GetTensDigitWord(digits));
        }