Beispiel #1
0
        public void TestRock()
        {
            var point = new Point(0, 0);
            var robot = new SimpleRobot(point, 0, _holder, 5, 5);

            //put a rock at 0,2, try to move forward 3,  make sure we stay at 0,1
            _holder.SetObstacle(0, 2, _rock);
            robot.Move('F');
            robot.Move('F');
            robot.Move('F');
            var newPoint = robot.GetLocation();

            Assert.AreEqual(0, newPoint.XPoint);
            Assert.AreEqual(1, newPoint.YPoint);
        }
 public void SetGetObstacleByCoords()
 {
     _obstacleHolder = new ObstacleHolder(5, 5);
     _obstacleHolder.SetObstacle(new Point(2, 2), new Rock());
     Assert.IsInstanceOfType(_obstacleHolder.GetObstacle(new Point(2, 2)), typeof(IObstacle));
 }
 public void SetGetObstacleByPoint()
 {
     _obstacleHolder = new ObstacleHolder(5, 5);
     _obstacleHolder.SetObstacle(1, 1, new Rock());
     Assert.IsInstanceOfType(_obstacleHolder.GetObstacle(1, 1), typeof(IObstacle));
 }