public void TestInvalidCoordinateParamsFormat()
        {
            // arrange
            var paramParser = new CoordinateInstructionParamaterParser();

            string[] rawInput = "COORDINATE 3,3,SOUTH,2".Split(' ');

            // act and assert
            var exception = Assert.Throws <ArgumentException>(delegate { paramParser.ParseParameters(rawInput); });

            Assert.That(exception.Message, Is.EqualTo("Incomplete instruction. Please ensure that the COORDINATE instruction is using format: COORDINATE X,Y,D"));
        }
        public void TestInvalidCoordinateDirection()
        {
            // arrange
            var paramParser = new CoordinateInstructionParamaterParser();

            string[] rawInput = "COORDINATE 2,4,OneDirection".Split(' ');

            // act and assert
            var exception = Assert.Throws <ArgumentException>(delegate { paramParser.ParseParameters(rawInput); });

            Assert.That(exception.Message, Is.EqualTo("Invalid direction. Please select from one of the following directions: NORTH|EAST|SOUTH|WEST"));
        }
Ejemplo n.º 3
0
        // Extracts the parameters from the user input and returns it
        public CoordinateInstructionParameter ParseInstructionParameter(string[] input)
        {
            var coordinateInstructionParameter = new CoordinateInstructionParamaterParser();

            return(coordinateInstructionParameter.ParseParameters(input));
        }