Exemple #1
0
        public void NumberToWord_DoSingleDigitNumbersConvertCorrectly_Nine()
        {
            NumToWord numbah = new NumToWord();

            NumToWord.FillDictionaries();
            NumToWord.NumberToWord(9);
            Assert.AreEqual("Nine ", NumToWord.Word);
        }
Exemple #2
0
        public void NumberToWord_DoDoubleDigitNumbersGreaterThan19ConvertCorrectly_ThirtyFive()
        {
            NumToWord numbah = new NumToWord();

            NumToWord.FillDictionaries();
            NumToWord.NumberToWord(35);
            Assert.AreEqual("Thirty Five ", NumToWord.Word);
        }
Exemple #3
0
        public void NumberToWord_DoHundredsNotAddAnd_FourHundred()
        {
            NumToWord numbah = new NumToWord();

            NumToWord.FillDictionaries();
            NumToWord.NumberToWord(400);
            Assert.AreEqual("Four Hundred ", NumToWord.Word);
        }
Exemple #4
0
        public void NumberToWord_Do4DigitNumbersConvertCorrectly_FourThousandFourHundredThirtyGive()
        {
            NumToWord numbah = new NumToWord();

            NumToWord.FillDictionaries();
            NumToWord.NumberToWord(4435);
            Assert.AreEqual("Four Thousand Four Hundred and Thirty Five ", NumToWord.Word);
        }
Exemple #5
0
        public void NumberToWord_CheckIfNegativeNumbersAboveNegative20ParseProperWords_NegativeNineteen()
        {
            NumToWord numbah = new NumToWord();

            NumToWord.FillDictionaries();
            NumToWord.NumberToWord(-19);
            Assert.AreEqual("Negative Nineteen ", NumToWord.Word);
        }
Exemple #6
0
        public void NumberToWord_DoBillionsNumbersConvertCorrectly_OneBillionTwoMillionOneHundredFourThousandFourHundredThirtyFive()
        {
            NumToWord numbah = new NumToWord();

            NumToWord.FillDictionaries();
            NumToWord.NumberToWord(1002104435);
            Assert.AreEqual("One Billion Two Million One Hundred and Four Thousand Four Hundred and Thirty Five ", NumToWord.Word);
        }
        public void ToWords_Case1_True()
        {
            //arrange
            string testNumber1 = "964";
            //act
            string result1 = NumToWord.ToWords(testNumber1);

            //assert
            Assert.AreEqual("nine hundred sixty four", result1);
        }
        public void ToWords_Case2_True()
        {
            //arrange
            string testNumber2 = "213";
            //act
            string result2 = NumToWord.ToWords(testNumber2);

            //assert
            Assert.AreEqual("two hundred thirteen", result2);
        }
Exemple #9
0
        public void ConvertArrayToWords_ConvertedArray_True()
        {
            //arrange
            int[]  aa = new int[] { 3, 7, 8 };
            string er = "eight hundred seventy three";
            //act
            NumToWord ntw = new NumToWord();
            string    ar  = ntw.ConvertArrayToWords(aa);

            Assert.AreEqual(er, ar);
        }
Exemple #10
0
        public void ConvertArrayToWords_ConvertedArrayWithTeens_True()
        {
            //arrange
            int[]  aa = new int[] { 1, 1, 8 };
            string er = "eight hundred eleven";
            //act
            NumToWord ntw = new NumToWord();
            string    ar  = ntw.ConvertArrayToWords(aa);

            Assert.AreEqual(er, ar);
        }
Exemple #11
0
        public void Convert_TestIntegrationMethod_True2()
        {
            //arrange
            int    num = 50423524;
            string er  = "fifty million four hundred twenty three thousand five hundred twenty four";
            //act
            NumToWord ntw = new NumToWord();
            string    ar  = ntw.Convert(num);

            Assert.AreEqual(er, ar);
        }
Exemple #12
0
        public void Convert_TestIntegrationMethod_True3()
        {
            //arrange
            int    num = 554;
            string er  = "five hundred fifty four";
            //act
            NumToWord ntw = new NumToWord();
            string    ar  = ntw.Convert(num);

            Assert.AreEqual(er, ar);
        }
Exemple #13
0
        public void NumberToWord_CheckIfNumberBelowTwentyReturnsProperWordValue_Nineteen()
        {
            // Arrange
            NumToWord numbah = new NumToWord();

            // Act
            NumToWord.FillDictionaries();
            NumToWord.NumberToWord(19);
            // Assert
            Assert.AreEqual("Nineteen ", NumToWord.Word);
        }
Exemple #14
0
        public void Convert_TestIntegrationMethod_True4()
        {
            //arrange
            int    num = 504513321;
            string er  = "five hundred four million five hundred thirteen thousand three hundred twenty one";
            //act
            NumToWord ntw = new NumToWord();
            string    ar  = ntw.Convert(num);

            Assert.AreEqual(er, ar);
        }
Exemple #15
0
        public void ConvertListOfArraysToString_CreateFinalOutput_True()
        {
            //arrange
            List <int[]> al = new List <int[]> {
                new int[] { 3, 7, 8 }, new int[] { 4, 6, 4 }, new int[] { 6 }
            };
            string er = "six million four hundred sixty four thousand eight hundred seventy three";
            //act
            NumToWord ntw = new NumToWord();
            string    ar  = ntw.ConvertListOfArraysToString(al);

            Assert.AreEqual(er, ar);
        }
        public void SetUserNumber_GetUserNumber_True()
        {
            //arrange
            NumToWord newNumToWord = new NumToWord();
            string    testNumber   = "8";

            //act
            newNumToWord.SetUserNumber(testNumber);
            string result = newNumToWord.GetUserNumber();

            //assert
            Assert.AreEqual(testNumber, result);
        }
        public void Index_Case2_True()
        {
            //arrange
            string    testNumber3   = "2342432";
            NumToWord newNumToWord1 = new NumToWord();

            //act
            newNumToWord1.SetUserNumber(testNumber3);
            newNumToWord1.ListOfThrees();
            int result3 = NumToWord.GetIndex();

            //assert
            Assert.AreEqual(3, result3);
        }
        public void ListOfThrees_True()
        {
            //arrange
            NumToWord     newNumToWord = new NumToWord();
            string        testNumber   = "34503830495";
            List <string> list         = new List <string> {
                "034", "503", "830", "495"
            };

            //act
            newNumToWord.SetUserNumber(testNumber);
            List <string> result = newNumToWord.ListOfThrees();

            //assert
            CollectionAssert.AreEqual(list, result);
        }
Exemple #19
0
        public void makeListOfThreeElementArray_ConvertsList_True()
        {
            //arrange
            List <int> aa = new List <int> {
                3, 7, 8, 4, 6, 4, 6
            };
            List <int[]> er = new List <int[]> {
                new int[] { 3, 7, 8 }, new int[] { 4, 6, 4 }, new int[] { 6 }
            };
            //act
            NumToWord    ntw = new NumToWord();
            List <int[]> ar  = ntw.MakeListOfThreeElementArrays(aa);

            for (int i = 0; i < er.Count; i++)
            {
                CollectionAssert.AreEqual(er[i], ar[i]);
            }
        }