コード例 #1
0
ファイル: TestKing.cs プロジェクト: DayLater/ChessProject
        public void FindPosibleWaysWithoutEnemies()
        {
            var  map      = new Map();
            King king     = new King(new Position(2, 2), whitePlayer);
            var  expected = new[]
            {
                new Position(1, 1), new Position(2, 1), new Position(3, 1), new Position(1, 2),
                new Position(1, 3), new Position(2, 3), new Position(3, 3), new Position(3, 2)
            };

            map[2, 2] = king;
            var result = king.FindPosibleWays(map);

            Assert.That(result.ToArray(), Is.EquivalentTo(expected));
        }
コード例 #2
0
ファイル: TestKing.cs プロジェクト: DayLater/ChessProject
        public void FindPosibleWaysWithEnemies()
        {
            var      map      = new Map();
            King     king     = new King(new Position(2, 2), whitePlayer);
            Elephant elephant = new Elephant(new Position(3, 1), whitePlayer);
            Pawn     pawn     = new Pawn(new Position(1, 1), blackPlayer);
            var      expected = new[]
            {
                new Position(1, 1), new Position(2, 1), new Position(1, 2), new Position(3, 2),
                new Position(1, 3), new Position(2, 3), new Position(3, 3)
            };

            map[3, 1] = elephant;
            map[1, 1] = pawn;
            map[2, 2] = king;
            var result = king.FindPosibleWays(map);

            Assert.That(result.ToArray(), Is.EquivalentTo(expected));
        }