Ejemplo n.º 1
0
        public void FactorialCalculation_CalculateSumFactorial_ShouldMatchResult()
        {
            FactorialCalculation calc = new FactorialCalculation();
            //arrange
            List <NumberAndResult> testCases = new List <NumberAndResult>
            {
                new NumberAndResult(2, 2),
                new NumberAndResult(3, 6),
                new NumberAndResult(5, 3),
                new NumberAndResult(7, 9),
                new NumberAndResult(9, 27),
                new NumberAndResult(100, 648)
            };

            //Act
            Assert.All(testCases, item => Assert.Equal(item.result, calc.CalculateSumFactorial(item.number)));
        }
Ejemplo n.º 2
0
        public void FactorialCalculation_CalculateFactorial_ShouldMatchResult(int number, string result)
        {
            FactorialCalculation calc = new FactorialCalculation();
            //arrange
            ArrayList array = calc.getMultiplyResults(number);

            array.Reverse();
            String resultFromList = string.Empty;

            for (int i = 0; i < array.Count; i++)
            {
                resultFromList += array[i].ToString();
            }

            //Act
            Assert.Equal(result, resultFromList);
        }