Beispiel #1
0
        public void CheckPointIsEmpty_EmptyPlato_ShouldTrue()
        {
            IPlateau plateau = new Plateau("plateau", new Point(0, 0), new Point(5, 5));

            plateau.DeployRover(new Rover(plateau, new Point(4, 3), "rover_1", Direction.East));
            plateau.Name.Should().NotBeNullOrEmpty();
            plateau.CheckPointIsEmpty(new Point(0, 0)).Should().BeTrue();
            plateau.CheckPointIsEmpty(new Point(0, 1)).Should().BeTrue();
            plateau.CheckPointIsEmpty(new Point(5, 5)).Should().BeTrue();
            plateau.CheckPointIsEmpty(new Point(2, 4)).Should().BeTrue();
        }
Beispiel #2
0
        public void CheckPointIsEmpty_NotIncludedPoint_ShouldFalse()
        {
            IPlateau plateau = new Plateau("plateau", new Point(0, 0), new Point(5, 5));

            plateau.DeployRover(new Rover(plateau, new Point(1, 1), "rover_1", Direction.East));
            plateau.Name.Should().NotBeNullOrEmpty();
            plateau.CheckPointIsEmpty(new Point(9, 0)).Should().BeFalse();
            plateau.CheckPointIsEmpty(new Point(1, 1)).Should().BeFalse();
            plateau.CheckPointIsEmpty(new Point(6, 5)).Should().BeFalse();
            plateau.CheckPointIsEmpty(new Point(2, 7)).Should().BeFalse();
        }
Beispiel #3
0
        public Point Move()
        {
            int x = Point.X;
            int y = Point.Y;

            switch (Direction)
            {
            case Direction.North:
                y += 1;
                break;

            case Direction.South:
                y -= 1;
                break;

            case Direction.East:
                x += 1;
                break;

            case Direction.West:
                x -= 1;
                break;
            }

            Point currentPoint = new Point(x, y);

            if (Plateau.CheckPointIsEmpty(currentPoint))
            {
                Point = currentPoint;
            }

            return(Point);
        }