public void Display(string GRID, string rover1Intial, string roverDir, string rover2Initial, string rover2Dir) { ILandingSurface landingSurface = new Plateau(GRID); RoverSquad roverSquad = new RoverSquad(landingSurface); roverSquad.DeployNewRover(rover1Intial, roverDir); roverSquad.DeployNewRover(rover2Initial, rover2Dir); int roverOneIdx = 0; int roverTwoIdx = 1; IRover roverOne = roverSquad[roverOneIdx]; IRover roverTwo = roverSquad[roverTwoIdx]; Console.WriteLine("Input"); Console.WriteLine(GRID); Console.WriteLine(rover1Intial); Console.WriteLine(roverDir); Console.WriteLine(rover2Initial); Console.WriteLine(rover2Dir); Console.WriteLine("\n"); Console.WriteLine("OUTPUT"); Console.WriteLine(roverOne.XCoordinate.ToString() + " " + roverOne.YCoordinate.ToString() + " " + roverOne.DirectionFacing); Console.WriteLine(roverTwo.XCoordinate.ToString() + " " + roverTwo.YCoordinate.ToString() + " " + roverTwo.DirectionFacing); Console.ReadLine(); }
public void TestRovers() { Plateau plateau = new Plateau("5 5"); RoverSquad roverSquad = new RoverSquad(plateau); roverSquad.DeployNewRover("1 2 N", "LMLMLMLMM"); roverSquad.DeployNewRover("3 3 E", "MMRMMRMRRM"); int noRovers = 2; Assert.True(roverSquad.Count == noRovers); }
public void TestInvalidRoverMovement() { Plateau plateau = new Plateau("1 1"); RoverSquad roverSquad = new RoverSquad(plateau); Assert.Throws <InvalidOperationException>(() => roverSquad.DeployNewRover("1 2 N", "LMLMLMLMM")); }
public void RoversCordinatesOutOfBound() { ILandingSurface landingSurface = new Plateau("5 5"); RoverSquad roverSquad = new RoverSquad(landingSurface); roverSquad.DeployNewRover("1 2 N", "LMMMMM"); roverSquad.DeployNewRover("3 3 E", "MMRMMRMMMMMMMMMMMMMMMMMMMMM"); int roverOneIdx = 0; int roverTwoIdx = 1; IRover roverOne = roverSquad[roverOneIdx]; IRover roverTwo = roverSquad[roverTwoIdx]; Assert.IsTrue(roverOne.DirectionFacing == "OUTOFBOUND", "OUTOFBOUND"); Assert.IsTrue(roverTwo.DirectionFacing == "OUTOFBOUND", "OUTOFBOUND"); }
public void DeployRoversTest() { ILandingSurface landingSurface = new Plateau("5 5"); RoverSquad roverSquad = new RoverSquad(landingSurface); roverSquad.DeployNewRover("1 2 N", "LMLMLMLMM"); roverSquad.DeployNewRover("3 3 E", "MMRMMRMRRM"); int noRovers = 2; int roverOneIdx = 0; int roverTwoIdx = 1; Assert.IsTrue(roverSquad.Count == noRovers); IRover roverOne = roverSquad[roverOneIdx]; IRover roverTwo = roverSquad[roverTwoIdx]; Assert.IsNotNull(roverOne); Assert.IsNotNull(roverTwo); }
public void DeployRoversAndTestCoordinates() { ILandingSurface landingSurface = new Plateau("10 10"); RoverSquad roverSquad = new RoverSquad(landingSurface); roverSquad.DeployNewRover("1 2 N", "LMLMLMLMM"); roverSquad.DeployNewRover("3 3 E", "MMRMMRMRRM"); int roverOneIdx = 0; int roverTwoIdx = 1; IRover roverOne = roverSquad[roverOneIdx]; IRover roverTwo = roverSquad[roverTwoIdx]; Assert.IsTrue(roverOne.XCoordinate == 1, "RoverOne: X != 1"); Assert.IsTrue(roverOne.YCoordinate == 3, "RoverOne: Y != 3"); Assert.IsTrue(roverOne.DirectionFacing == "N", "RoverOne: Direction != North"); Assert.IsTrue(roverTwo.XCoordinate == 5, "RoverTwo: X != 5"); Assert.IsTrue(roverTwo.YCoordinate == 1, "RoverTwo: Y != 1"); Assert.IsTrue(roverTwo.DirectionFacing == "E", "RoverTwo: Direction != East"); }
public void TestRoverMovement() { Plateau plateau = new Plateau("5 5"); RoverSquad roverSquad = new RoverSquad(plateau); roverSquad.DeployNewRover("1 2 N", "LMLMLMLMM"); roverSquad.DeployNewRover("3 3 E", "MMRMMRMRRM"); int roverOneIdx = 0; int roverTwoIdx = 1; IRover roverOne = roverSquad[roverOneIdx]; IRover roverTwo = roverSquad[roverTwoIdx]; Assert.True(roverOne.XCoordinate == 1); Assert.True(roverOne.YCoordinate == 3); Assert.True(roverOne.Direction == "N"); Assert.True(roverTwo.XCoordinate == 5); Assert.True(roverTwo.YCoordinate == 1); Assert.True(roverTwo.Direction == "E"); }