예제 #1
0
        private void CreateFactorFinderInstance()
        {
            int numToFactor = ConsoleInput.NumToFactor();

            _finder = new FactorFinder();
            _finder.FindFactors(numToFactor);
        }
예제 #2
0
        public void TestFindFactorials()
        {
            var finder = new FactorFinder();

            Assert.That(finder.FindFactors(0), Is.EqualTo(new int[] {}));
            Assert.That(finder.FindFactors(5), Is.EqualTo(new[] { 1 }));
            Assert.That(finder.FindFactors(11), Is.EqualTo(new[] { 1 }));
            Assert.That(finder.FindFactors(12), Is.EqualTo(new[] { 1, 2, 3, 4, 6 }));
            Assert.That(finder.FindFactors(81), Is.EqualTo(new[] { 1, 3, 9, 27 }));
            Assert.That(finder.FindFactors(144), Is.EqualTo(new[] { 1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 36, 48, 72 }));
        }
예제 #3
0
        public void findFactors(int input, int[] expectedOutput)
        {
            int[] actualOutput = _factors.FindFactors(input);

            Assert.AreEqual(expectedOutput, actualOutput);
        }