public void CanIGetANumberEqualThanOneHundredMillion()
        {
            var siblingNumber = new SiblingNumber();
            var result        = siblingNumber.Largest(100000000);

            Assert.AreEqual(100000000, result);
        }
        public void CanISendANumberBiggerThanOneHundredMillion()
        {
            var siblingNumber = new SiblingNumber();
            var result        = siblingNumber.Largest(100000001);

            Assert.AreEqual(-1, result);
        }
        public void LargestSiblingNumberCanSatisfyBasicTestPart4()
        {
            var siblingNumber = new SiblingNumber();
            var result        = siblingNumber.Largest(123);

            Assert.AreEqual(321, result);
        }
        public void LargestSiblingNumberCanSatisfyBasicTestPart2()
        {
            var siblingNumber = new SiblingNumber();
            var result        = siblingNumber.Largest(535);

            Assert.AreEqual(553, result);
        }
예제 #5
0
        private static int Calculate()
        {
            Console.WriteLine("Please enter a number to discover your largest sibling number or -1 to exit");
            var result      = Console.ReadLine();
            var inputNumber = Convert.ToInt32(result);

            if (inputNumber != -1)
            {
                var siblingNumber        = new SiblingNumber();
                var largestSiblingNumber = siblingNumber.Largest(inputNumber);
                if (largestSiblingNumber == -1)
                {
                    Console.WriteLine("The result exceeds 100,000,000");
                    Console.ReadLine();
                    return(largestSiblingNumber);
                }

                Console.WriteLine($"The sibling number is {largestSiblingNumber}");
                return(largestSiblingNumber);
            }

            return(inputNumber);
        }
 public void CanISendNegativeNumber()
 {
     var siblingNumber = new SiblingNumber();
     var result        = siblingNumber.Largest(-1);
 }