Exemplo n.º 1
0
        public void TestReadToEndWithNegativeNumbers()
        {
            FibonacciTextReader fibTest = new FibonacciTextReader(-2);
            string output = fibTest.ReadToEnd();

            Assert.That(output, Is.EqualTo(string.Empty));
        }
Exemplo n.º 2
0
        public void TestReadToEndWithZero()
        {
            FibonacciTextReader fibTest = new FibonacciTextReader(0);
            string output = fibTest.ReadToEnd();

            Assert.That(output, Is.EqualTo(string.Empty));
        }
Exemplo n.º 3
0
        public void TestReadToEndWithSpecialCases()
        {
            FibonacciTextReader fibTest = new FibonacciTextReader(2);
            string output    = fibTest.ReadToEnd();
            int    fibNumber = fibTest.NumberOfSequence;

            // Checks the first case of 0
            if (fibNumber == 0)
            {
                Assert.That(output, Is.EqualTo("1: 0\r\n"));
            }

            // Checks the second case of 1
            if (fibNumber == 1)
            {
                Assert.That(output, Is.EqualTo("1: 0\r\n" + "2: 1\r\n"));
            }
        }
Exemplo n.º 4
0
        //load the first 100 numbers of the Fibonacci sequence
        private void loadFibonacciNumbersfirst100ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FibonacciTextReader sr = new FibonacciTextReader(100);

            textBox1.Text = sr.ReadToEnd();
        }