static void Main(string[] args) { const string fileName = "BulkDeploy.txt"; using (var streamReader = File.OpenText(fileName)) { var line = streamReader.ReadLine(); if (line != null) { var plateau = Plateau.CreatePlateau(line); var count = 0; Rover rover = null; while ((line = streamReader.ReadLine()) != null) { if (count % 2 == 0) { rover = Rover.CreateRover(line); rover.SetPlateau(plateau); } else { rover.ExecuteBatchCmds(line); Console.WriteLine(rover.GetPosition()); } count++; } } } Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
public void CreatePlateau_55_CoordinatesEqual55ReturnTrue() { // Act var plateau = Plateau.CreatePlateau("5 5"); var coordinates = new Coordinates(5, 5); // Assert Assert.That(plateau.UpperRight.Y == coordinates.Y && plateau.UpperRight.X == coordinates.X); }
public void PreparePlateau(PlateauModel model) { if (model.ErrorTracer == null) { _plateaus = Plateau.CreatePlateau(this); if (model.UpperRight <= 0 && model.LowerLeft <= 0) { _plateaus.ErrorMessage = MessageConstant.PlateauLimitsFail; } _plateaus.LowerLeft = model.LowerLeft; _plateaus.UpperRight = model.UpperRight; } }
public HttpResponseMessage DeployRover([FromBody] RoverConfig roverconfig) { try { Rover rover = null; var plateau = Plateau.CreatePlateau(roverconfig.Plateau); rover = Rover.CreateRover(roverconfig.StartPosition); rover.SetPlateau(plateau); rover.ExecuteBatchCmds(roverconfig.MoveCommands); return(Request.CreateResponse(HttpStatusCode.Created, rover.GetPosition())); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, message: ex.Message)); } }
public void CreatePlateau_XX_WrongDimensionsExceptionReturnFalse() { // Act Plateau.CreatePlateau("X X"); }