예제 #1
0
        public void Then_the_ship_moves_forward()
        {
            const int distance  = 5;
            var       shipMover = new ShipMoverUsingWaypoint();

            shipMover.InitialisePosition(new Point(0, 0));
            shipMover.MoveForward(distance);
            Assert.That(shipMover.GetPosition(), Is.EqualTo(new Point(50, 5)));
        }
예제 #2
0
        public void Then_the_ship_moves_forward_after_rotation_right()
        {
            const int distance  = 5;
            var       shipMover = new ShipMoverUsingWaypoint();

            shipMover.InitialisePosition(new Point(0, 0));
            shipMover.RotateRight(270);
            shipMover.MoveForward(distance);
            Assert.That(shipMover.GetPosition(), Is.EqualTo(new Point(-5, 50)));
        }
예제 #3
0
        public void Then_the_ship_moves_forward_after_rotation_left()
        {
            //the ship starts facing east
            const int distance  = 5;
            var       shipMover = new ShipMoverUsingWaypoint();

            shipMover.InitialisePosition(new Point(0, 0));
            shipMover.RotateLeft(270);
            shipMover.MoveForward(distance);
            Assert.That(shipMover.GetPosition(), Is.EqualTo(new Point(5, -50)));
        }