Пример #1
0
        public void StartingBlackOthersTest()
        {
            GameBoard gb = new GameBoard(8, 8);

            List <IPiece> expected = new List <IPiece>();

            IPiece others1 = new Rook(ChessColor.Black);

            others1.AddAtLocation(7, 0);
            expected.Add(others1);

            IPiece others2 = new Knight(ChessColor.Black);

            others2.AddAtLocation(7, 1);
            expected.Add(others2);

            IPiece others3 = new Bishop(ChessColor.Black);

            others3.AddAtLocation(7, 2);
            expected.Add(others3);

            IPiece others4 = new King(ChessColor.Black);

            others4.AddAtLocation(7, 3);
            expected.Add(others4);

            IPiece others5 = new Queen(ChessColor.Black);

            others5.AddAtLocation(7, 4);
            expected.Add(others5);

            IPiece others6 = new Bishop(ChessColor.Black);

            others6.AddAtLocation(7, 5);
            expected.Add(others6);

            IPiece others7 = new Knight(ChessColor.Black);

            others7.AddAtLocation(7, 6);
            expected.Add(others7);

            IPiece otherssize = new Rook(ChessColor.Black);

            otherssize.AddAtLocation(7, 7);
            expected.Add(otherssize);

            List <IPiece> actual = gb.pieces.FindAll(e => e.Type != ChessPiece.Pawn && e.Color == ChessColor.Black);

            // both arrays are same length
            Assert.AreEqual(expected.Count, actual.Count);

            for (int i = 0; i < expected.Count; i++)
            {
                Assert.AreEqual(expected[i].ColID, actual[i].ColID);
                Assert.AreEqual(expected[i].RowID, actual[i].RowID);
            }
        }