コード例 #1
0
        public void CalculateFibonacci_CanOuput()
        {
            var co     = new CareOregonTest.Program();
            var result = co.CalculateFibonacci(3);

            Assert.IsTrue(result > 0, "Result not greater than zero");
        }
コード例 #2
0
        public void CalculateFibonacci_CanOuput_Position_10()
        {
            var co     = new CareOregonTest.Program();
            var result = co.CalculateFibonacci(10);

            Assert.IsTrue(result > 0, "Result not greater than zero");
            Assert.AreEqual(89, result, "Result for position 10 is " + result + " and should be 89");
        }
コード例 #3
0
        public void CalculateFibonacci_CanOuput_Positions_40()
        {
            var co     = new CareOregonTest.Program();
            var result = co.CalculateFibonacci(40);

            Assert.IsTrue(result > 0, "Result not greater than zero");
            Assert.AreEqual(165580141, result, "Result for position 40 is " + result + " and should be 165580141");
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Input the Fibonacci position you would like to see the value of");

            int desiredPositon;

            int.TryParse(Console.ReadLine(), out desiredPositon);

            var p = new Program();

            Console.WriteLine(String.Format("The value at position {0} = {1}", desiredPositon, p.CalculateFibonacci(desiredPositon)));
        }