Exemplo n.º 1
0
        private IEnumerable <ThreeDigit> SplitToThree(string number)
        {
            List <ThreeDigit> group = new List <ThreeDigit>();

            for (int i = number.Length - 3; i >= 0; i -= 3)
            {
                group.Add(ThreeDigit.Of(number.Substring(i, 3).TrimStart('0')));
            }

            if (IsNotMultipleOfThree(number.Length))
            {
                group.Add(ThreeDigit.Of(number.Substring(0, number.Length % 3).TrimStart('0')));
            }

            return(group);
        }
Exemplo n.º 2
0
        public void ThreeDigit_ToWords_Test(string expected, string number)
        {
            string words = ThreeDigit.Of(number).ToWords();

            Assert.AreEqual(expected, words);
        }