Example #1
0
 public void Test_LeftAfterPlaceCmd()
 {
     Robot robot = new Robot();
     PlaceAtOrigin(robot);
     robot.Left();
     Assert.AreEqual(robot.Face, Direction.West);
 }
Example #2
0
        public void Test_MoveAfterPlaceCmd()
        {
            Robot robot = new Robot();

            PlaceAtOrigin(robot);
            
            Assert.IsTrue(robot.Move());
        }
Example #3
0
        public void Test_ParseValidCommand()
        {

            Robot robot = new Robot();
            RemoteController controller = new RemoteController(robot);
            controller.RunCommand("Place 1,2,EAST");
            Assert.AreEqual(controller.ParseCommand("MOVE"), Command.Move);

        }      
Example #4
0
 public void Test_RunCommand() {
     Robot robot = new Robot();
     RemoteController controller = new RemoteController(robot);
     controller.RunCommand("Place 1,2,EAST");
     controller.RunCommand("Move");
     controller.RunCommand("Move");
     controller.RunCommand("LEFT");
     controller.RunCommand("Move");
     
     Assert.AreEqual(robot.Report(), "Output: 3,3,NORTH");
 }
Example #5
0
        public void Test_IgnoreInvalidPlaceCmd()
        {
            Robot robot = new Robot();

            Assert.IsFalse(robot.Place(new PlaceArguments()
            {
                Face = Direction.North,
                X = 10,
                Y = 10,
            })
            );
        }
Example #6
0
        public RemoteController(Robot _robot)
        {
            robot = _robot;

        }
Example #7
0
 public void Test_ReportAfterPlaceCmd()
 {
     Robot robot = new Robot();
     PlaceAtOrigin(robot);
     robot.Move();
     robot.Right();
     Assert.AreEqual(robot.Report(), "Output: 0,1,EAST");
 }
Example #8
0
 public void Test_ReportBeforePlaceCmd()
 {
     Robot robot = new Robot();
     Assert.AreEqual(robot.Report(),"Error");
 }
Example #9
0
 public void Test_LeftBeforePlaceCmd()
 {
     Robot robot = new Robot();
     Assert.IsFalse(robot.Left());
 }
Example #10
0
 public void Test_RightBeforePlaceCmd()
 {
     Robot robot = new Robot();
     Assert.IsFalse(robot.Right());
 }
Example #11
0
 public void Test_MoveBeforePlaceCmd()
 {
     Robot robot = new Robot();
     Assert.IsFalse(robot.Move());
 }
Example #12
0
        public void Test_PlaceCmd()
        {
            Robot robot = new Robot();

            Assert.IsTrue(PlaceAtOrigin(robot));
        }
Example #13
0
        private bool PlaceAtOrigin(Robot robot)
        {
           return ( robot.Place(new PlaceArguments()
            {

                Face = Direction.North,
                X = 0,
                Y = 0,
            }));
        }