示例#1
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));
        }
示例#2
0
        public void Given_Command_Then_RoverMoveIsCalledTheCorrectAmmountOfTimes(string initialPosition, string command, int repeatMove, int repeatLeft, int repeatRight)
        {
            var rover           = MockRepository.GenerateStub <IRover>();
            var roverController = new RoverController(rover);

            roverController.CommandRover(command);

            rover.AssertWasCalled(r => r.Move(), move => move.Repeat.Times(repeatMove));
            rover.AssertWasCalled(r => r.RotateLeft(), rotateLeft => rotateLeft.Repeat.Times(repeatLeft));
            rover.AssertWasCalled(r => r.RotateRight(), rotateRight => rotateRight.Repeat.Times(repeatRight));
        }