コード例 #1
0
 public void TestProcessRoverMovementInstructionsRoverMovesTwoMs()
 {
     Platue currentPlatue=new Platue(new Point(10,10));
     IRover currentRover=new Rover(new Point(0,0), CardinalCompassPoints.N );
     IEnumerable<char> instructions = new List<char>() {'M', 'M'};
     IRoverBusinessLogic businessLogic = new RoverBusinessLogic(new InputParser(currentPlatue, currentRover, instructions));
     string actualNewPosition=businessLogic.ProcessRoverMovementInstructions();
     string expectedRoverPosition = "0 2 N";
     Assert.IsTrue(expectedRoverPosition==actualNewPosition);
 }
コード例 #2
0
 public void TestParsedRoverPositionInputDataIsValid()
 {
     string roverPosition = "0 0 N";
     IInputParser inputParser = new InputParser();
     inputParser.ParseInputRoverPosition(roverPosition);
     IRover actualRover = inputParser.Rover;
     IRover expectedRover = new Rover(new Point(0,0), CardinalCompassPoints.N);
     Assert.IsTrue(expectedRover.Coordinates.x == actualRover.Coordinates.x && expectedRover.Coordinates.y == actualRover.Coordinates.y && expectedRover.Orientation== actualRover.Orientation, "Valid rover's position data cannot be parsed");
 }