public void ValidInput()
        {
            int expected = 1;
            string filePath = Environment.CurrentDirectory + "\\TestFiles\\valid.txt";
            PlainTextFibonacciInput testInput = new PlainTextFibonacciInput(filePath);

            int actual = testInput.GetValue();

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        private static int GetInputValue(CliOptions options)
        {
            IFibonacciInput inputMethod;

            if (options.InteractiveMode)
            {
                inputMethod = new InteractiveFibonacciInput();
            }
            else if (options.InputFile == null)
            {
                // attempt to parse InputNumber
                return BaseFibonacciInput.ParseStringArgument(options.InputNumber);
            }
            else if (Path.GetExtension(options.InputFile) == ".xml")
            {
                inputMethod = new XMLFibonacciInput(options.InputFile);
            }
            else
            {
                inputMethod = new PlainTextFibonacciInput(options.InputFile);
            }

            return inputMethod.GetValue();
        }
 public void XMLInput()
 {
     string filePath = Environment.CurrentDirectory + "\\TestFiles\\valid.xml";
     PlainTextFibonacciInput testInput = new PlainTextFibonacciInput(filePath);
     int testNumber = testInput.GetValue();
 }
 public void TooLargeInput()
 {
     string filePath = Environment.CurrentDirectory + "\\TestFiles\\huge.txt";
     PlainTextFibonacciInput testInput = new PlainTextFibonacciInput(filePath);
     int testNumber = testInput.GetValue();
 }
 public void NonexistantInput()
 {
     string filePath = Environment.CurrentDirectory + "\\TestFiles\\doesntExist.txt";
     PlainTextFibonacciInput testInput = new PlainTextFibonacciInput(filePath);
     int testNumber = testInput.GetValue();
 }