Exemple #1
0
        public void AndTheCommandIsMoveForwardThenRoverMovedForwardWithLogging()
        {
            _roverDecorator.ProcessCommand(Command.MoveForward);

            _rover.Received(1).MoveForward();
            _logger.Received(1).Log("Rover moved forward.");
            _logger.Received(1).Log(Arg.Is <string>(s => s.StartsWith("Rover is at ")));
        }
Exemple #2
0
        public void SendLongCommand_ExpectedCalls()
        {
            IRover          mockedRover = Substitute.For <IRover>();
            IRoverCommander commander   = new RoverCommander(mockedRover);

            commander.SendCommands("MRLLRRMMMLL");

            mockedRover.Received(4).Move();
            mockedRover.Received(3).RotateCW();
            mockedRover.Received(4).RotateCCW();
        }
Exemple #3
0
        public void SendCommand_M_Move()
        {
            IRover          mockedRover = Substitute.For <IRover>();
            IRoverCommander commander   = new RoverCommander(mockedRover);

            commander.SendCommand('M');

            mockedRover.Received(1).Move();
        }
Exemple #4
0
        public void SendCommand_R_RotateRoverCW()
        {
            IRover          mockedRover = Substitute.For <IRover>();
            IRoverCommander commander   = new RoverCommander(mockedRover);

            commander.SendCommand('R');

            mockedRover.Received(1).RotateCW();
        }