Exemplo n.º 1
0
        public void GetLegalMoves(TestMoveData d)
        {
            Console.WriteLine(d.StartingFen);
            Console.WriteLine(d.Move);
            Console.WriteLine();

            var board      = d.StartingFen.ParseFen();
            var expected   = Move.Parse(d.Move);
            var legalMoves = board.GetLegalMovesFromSquare(expected.FromCell);

            if (d.ExpectedToBeValid)
            {
                legalMoves
                .Select(m => m.Move.ToString())
                .Should().Contain(d.Move);
                var single = legalMoves.Single(m => m.Move.ToString() == d.Move);
                single.Annotations.Should().Be(d.ExpectedAnnotations);
            }
            else
            {
                legalMoves
                .Select(m => m.Move.ToString())
                .Should().NotContain(d.Move);
            }
        }
Exemplo n.º 2
0
        public void CanBeValidMove(TestMoveData d)
        {
            Console.WriteLine(d.StartingFen);
            Console.WriteLine(d.Move);
            Console.WriteLine();

            var board    = d.StartingFen.ParseFen();
            var expected = Move.Parse(d.Move);

            if (!d.ExpectedToBeValid)
            {
                return;
            }
            CanBeValid.CanBeValidMove(
                board.Core.Cells,
                (Piece)board.Core.Cells[expected.FromCell],
                expected.FromCell,
                expected.ToCell).Should().BeTrue();
        }
Exemplo n.º 3
0
        public void GetLegalMoves(TestMoveData d)
		{
			Console.WriteLine(d.StartingFen);
			Console.WriteLine(d.Move);
			Console.WriteLine();

			var board = d.StartingFen.ParseFen();
			var expected = Move.Parse(d.Move);
            var legalMoves = board.GetLegalMovesFromSquare(expected.FromCell);
			if (d.ExpectedToBeValid)
			{
			    legalMoves
                    .Select(m => m.Move.ToString())
                    .Should().Contain(d.Move);
			    var single = legalMoves.Single(m => m.Move.ToString() == d.Move);
				single.Annotations.Should().Be(d.ExpectedAnnotations);
			}
			else
			{
                legalMoves
                    .Select(m => m.Move.ToString())
                    .Should().NotContain(d.Move);
			}
		}
Exemplo n.º 4
0
        public void CanBeValidMove(TestMoveData d)
		{
			Console.WriteLine(d.StartingFen);
			Console.WriteLine(d.Move);
			Console.WriteLine();

			var board = d.StartingFen.ParseFen();
			var expected = Move.Parse(d.Move);
			if (!d.ExpectedToBeValid) return;
            CanBeValid.CanBeValidMove(
                board.Core.Cells,
                (Piece)board.Core.Cells[expected.FromCell],
				expected.FromCell,
				expected.ToCell).Should().BeTrue();
		}