Ejemplo n.º 1
0
        public void Given_Command_Then_RoverIsDeployedToCorrectLocation(string deployCommand, int expectedMapX, int expectedMapY, int expectedStartX, int expectedStartY, string expectedOrientation)
        {
            var rover           = MockRepository.GenerateStub <IRover>();
            var roverController = new RoverController(rover);

            roverController.DeployRover(deployCommand);

            rover.AssertWasCalled(r => r.Land(Arg <Map> .Matches(m => m.X == expectedMapX && m.Y == expectedMapY), Arg <int> .Is.Equal(expectedStartX), Arg <int> .Is.Equal(expectedStartY), Arg <CompassPoint> .Is.Equal(ParseCompassPoint(expectedOrientation))));
        }
Ejemplo n.º 2
0
        public void Given_Command_Then_RoverNavigatesToCorrectLocation(string initialPosition, string command, string finalPosition)
        {
            var rover           = new Rover();
            var roverController = new RoverController(rover);

            roverController.DeployRover(initialPosition);
            roverController.CommandRover(command);

            Assert.That(roverController.ReportRoverPositionAndDirection(), Is.EqualTo(finalPosition));
        }
Ejemplo n.º 3
0
        public void ProcessInput(string[] input)
        {
            var inputParser = new InputParser(input);

            inputParser.Parse();

            var plateau = new Plateau(inputParser.PlateauWidth, inputParser.PlateauHeight);

            Controller = new RoverController(plateau);

            foreach (var roverInputModel in inputParser.Rovers)
            {
                var deployedRover = Controller.DeployRover(roverInputModel.DeployPosition);
                Controller.RunRoverCommans(deployedRover, roverInputModel.Commands);
            }
        }