예제 #1
0
        public string GetValidInput()
        {
            string coordinateInput = null;

            do
            {
                coordinateInput = Console.ReadLine();
                if (CoordinateTranslator.CoordinateLengthValidation(coordinateInput) == false)
                {
                    Console.WriteLine("Your coordinate must be between 2 and 3 characters");
                }
                else if (CoordinateTranslator.CheckForCoorLetter(coordinateInput) == false)
                {
                    Console.WriteLine("You need to choose a letter between a and j");
                }
                else if (CoordinateTranslator.NumberCheck(coordinateInput) == false)
                {
                    Console.WriteLine("You need to provide a number between 1 and 10");
                }
            } while (!CoordinateTranslator.CoordinateLengthValidation(coordinateInput) || !CoordinateTranslator.CheckForCoorLetter(coordinateInput) || !CoordinateTranslator.NumberCheck(coordinateInput));
            return(coordinateInput);
        }
        public void LetterCheck(string input, bool expected)
        {
            var actual = CoordinateTranslator.CheckForCoorLetter(input);

            Assert.AreEqual(expected, actual);
        }