Exemplo n.º 1
0
        public void TestBouncyNumbers()
        {
            int[] nonBouncyNumbers =
            {
                110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 122, 123, 124, 125, 126, 127, 128, 129, 133, 134, 135, 136, 137,
                138, 139, 144, 145, 146, 147, 148, 149, 155, 156, 157, 158, 159, 166, 167, 168, 169, 177, 178, 179, 188, 189, 199,
                200
            };

            List <int> nonBouncyNumberList = new List <int>();

            for (int i = 101; i <= 200; i++)
            {
                if (!TotalIncreasingOrDecreasingNumbers.IsBouncyNumber(i))
                {
                    nonBouncyNumberList.Add(i);
                }
            }

            Assert.True(nonBouncyNumberList.SequenceEqual(nonBouncyNumbers));
        }
Exemplo n.º 2
0
        public void TestTotalIncDecCount(int power, string expected)
        {
            BigInteger actual = TotalIncreasingOrDecreasingNumbers.TotalIncDec(power);

            Assert.Equal(BigInteger.Parse(expected), actual);
        }