Exemple #1
0
        public void TestAttackAndTake()
        {
            GameObject GameObject = new GameObject();
              GameObject.whites = new List<Figure>();
              GameObject.blacks = new List<Figure>();
              King wKing = new King(GameObject, 1, 5, Color.white);
              Pawn wPawn1 = new Pawn(GameObject, 3, 2, Color.white);
              Pawn wPawn2 = new Pawn(GameObject, 4, 2, Color.white);
              Pawn wPawn3 = new Pawn(GameObject, 5, 2, Color.white);
              King bKing = new King(GameObject, 8, 4, Color.black);
              Pawn bPawn1 = new Pawn(GameObject, 3, 7, Color.black);
              Pawn bPawn2 = new Pawn(GameObject, 4, 7, Color.black);
              Pawn bPawn3 = new Pawn(GameObject, 5, 7, Color.black);
              GameObject.whites.Add(wKing);
              GameObject.whites.Add(wPawn1);
              GameObject.whites.Add(wPawn2);
              GameObject.whites.Add(wPawn3);

              GameObject.blacks.Add(bKing);
              GameObject.blacks.Add(bPawn1);
              GameObject.blacks.Add(bPawn2);
              GameObject.blacks.Add(bPawn3);
              GameObject.UpdateAllBeatFields();

              Assert.IsTrue(wPawn1.CanAttackPosition(2, 3));
              Assert.IsTrue(wPawn1.CanAttackPosition(4, 3));

              Assert.IsTrue(bPawn2.CanAttackPosition(3, 6));
              Assert.IsTrue(bPawn2.CanAttackPosition(5, 6));
        }