Ejemplo n.º 1
0
        public void MoveFromOvestDirection_ObstaclePoint_ThrowException()
        {
            var       B = new Backward();
            Grid      G = new Grid(5, 5, new FakeObstacleGenerator());
            RoverMars R = new RoverMars('O');

            R.Position.X = 1;
            R.Position.Y = 2;
            B.MoveFromOvestDirection(R, G);
        }
Ejemplo n.º 2
0
 public void MoveFromOvestDirection_NewRoverPoint_OutOfGridValueLessThenZero_Expected_NewXEqualsMaxXOfGrid()
 {
     {
         var       B = new Backward();
         Grid      G = new Grid(5, 5, new FakeObstacleGenerator());
         RoverMars R = new RoverMars('O');
         R.Position.X = -2;
         R.Position.Y = 2;
         B.MoveFromOvestDirection(R, G);
         Point expectedNewRoverPosition = new Point(5, 2);
         Assert.AreEqual(expectedNewRoverPosition, R.Position);
     }
 }
Ejemplo n.º 3
0
        public void MoveFromOvestDirection_NewRoverPoint_OutOfGrid_Expected_NewXEqualsZero()
        {
            var       B = new Backward();
            Grid      G = new Grid(5, 5, new FakeObstacleGenerator());
            RoverMars R = new RoverMars('O');

            //rover orientation is ovest direction
            R.Position.X = 5;
            R.Position.Y = 1;
            B.MoveFromOvestDirection(R, G);
            Point expectedNewRoverPosition = new Point(0, 1);

            Assert.AreEqual(expectedNewRoverPosition, R.Position);
        }
Ejemplo n.º 4
0
        public void MoveFromOvestDirection_MoveRoverInXPluOne()
        {
            Backward B = new Backward();
            //rover orientation is ovest direction, is not responsibility of this class check direction
            RoverMars R = new RoverMars('O');

            //rover actual position is 1,1
            R.Position.X = 1;
            R.Position.Y = 1;
            Grid G = new Grid(5, 5, new FakeObstacleGenerator());

            B.MoveFromOvestDirection(R, G);
            Point expectedNewRoverPosition = new Point(2, 1);

            Assert.AreEqual(expectedNewRoverPosition, R.Position);
        }