예제 #1
0
        public void Should_parse_string_5_6()
        {
            //Given
            var coordinateString = "5 6";
            //When
            var parsedCoordinate = ParseCoordinate.From(coordinateString);

            //Then
            Assert.That(parsedCoordinate.X, Is.EqualTo(5), "X Coordinate");
            Assert.That(parsedCoordinate.Y, Is.EqualTo(6), "Y Coordinate");
        }
예제 #2
0
        public void SendCommand(IEnumerable <string> input)
        {
            var lowerLeftCoordinatesOfPlateau  = new Coordinate(0, 0);
            var upperRightCoordinatesOfPlateau = ParseCoordinate.From(input.First());

            var roverCommands = ParseRoverCommands.From(input);

            foreach (var roverCommand in roverCommands)
            {
                var rover = new Rover(roverCommand.StartingPosition, _output, _navigationSystem);
                foreach (var instruction in roverCommand.Instructions)
                {
                    rover.Send(instruction);
                }
                _rovers.Add(rover);
                _output.Write(rover.CurrentPosition.ToString());
            }
        }
예제 #3
0
        public void Should__throw_error_for_invalid_coordinate_string(string coordinateString)
        {
            var exception = Assert.Throws <InputBoundaryException>(() => ParseCoordinate.From(coordinateString));

            Assert.That(exception.Message, Is.EqualTo(coordinateString + " is not a valid coordinate"), "Hasn't thrown exception when given an incorrect coordinate string");
        }