コード例 #1
0
 public void robotShouldMoveAndTurnAndReportItsPosition()
 {
     var robot = new Robot ();
     robot.PlaceRobot (1, 1, DirectionFacing.East);
     robot.Move ();
     robot.TurnLeft ();
     robot.Move ();
     robot.Move ();
     Assert.AreEqual ("2, 3, North", robot.GetRobotPosition ());
 }
コード例 #2
0
 public void shouldRaiseAnErrorIfRobotNotProperlyPlacedWhenMoving()
 {
     var robot = new	Robot ();
     var result = robot.Move ();
     Assert.IsFalse (result);
     Assert.AreEqual ("Robot cannot move until it has been properly placed", robot.error);
 }
コード例 #3
0
 public void robotShouldMoveAndReportPositionCorrectly()
 {
     var robot = new Robot ();
     robot.PlaceRobot (1, 1, DirectionFacing.West);
     var result = robot.Move ();
     Assert.IsTrue (result);
     Assert.AreEqual ("0, 1, West", robot.GetRobotPosition ());
 }
コード例 #4
0
 public void shouldRaiseAnErrorWhenTryToMoveRobotOutOfTheGrid()
 {
     var robot = new Robot ();
     robot.PlaceRobot (5, 5, DirectionFacing.North);
     var result = robot.Move ();
     Assert.IsFalse (result);
     Assert.AreEqual ("Invalid placement, robot cannot move there", robot.error);
     Assert.AreEqual ("5, 5, North", robot.GetRobotPosition ());
 }