public IActionResult Input(InputModel inputModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _plateauService.IsValidPositionOnThePlateau(inputModel.Plateau.PlateauPosition);

                    _plateauService.SetPlateauPosition(inputModel.Plateau.PlateauPosition);

                    foreach (var rover in inputModel.RoverList)
                    {
                        _plateauService.IsValidRoverPositionOnThePlateau(rover.RoverPosition);

                        _roverService.TakeAction(inputModel, rover);
                    }
                }
            }
            catch (Exception ex)
            {
                ConfigureMeaningfulErrorMessage(ex);
            }

            return(View(inputModel));
        }
Exemplo n.º 2
0
 public void IsValidPositionOnThePlateau_Should_Return_As_Expected(Position position, bool expected)
 {
     if (expected)
     {
         _plateauService.IsValidPositionOnThePlateau(position);
         Assert.True(expected);
     }
     else
     {
         Assert.Throws <BusinessException>(() => _plateauService.IsValidPositionOnThePlateau(position));
     }
 }