Esempio n. 1
0
        public void RoverPostionShouldBeTwoDigitFollowedByOneCharacterCommandSeparatedBySpace(string command)
        {
            //Act
            Position position = _helper.ToRover(command);

            //Assert
            Assert.IsNotNull(position);
            Assert.AreEqual(_helper.ToString(position), command);
        }
        public IEnumerable <string> SendCommands([FromBody] Command command)
        {
            try
            {
                var plateau = _parse.ToPlateau(command.Plateau);
                var rovers  = new List <string>();

                foreach (var rover in command.Rovers)
                {
                    var position  = _parse.ToRover(rover.Position);
                    var movements = _parse.ToMovemenent(rover.Movement);
                    var result    = _squad.Deploy(plateau, position, movements);

                    rovers.Add(_parse.ToString(result));
                }

                return(rovers);
            }
            catch (Exception ex)
            {
                _logger.LogError("Failed to deploy rover!", ex);
                return(null);
            }
        }