public async void EatImpossible()
        {
            // Arrange
            var pathList = new List <Path>
            {
                PathFactory.Instance.AddToPath(Movement.Direction.Top).SetIsRecursive(false).Create(),
                PathFactory.Instance.AddToPath(Movement.Direction.Bottom).SetIsRecursive(true).Create(),
                PathFactory.Instance.AddToPath(Movement.Direction.Left).SetIsRecursive(true).Create()
            };

            var chessPieceMock = new Mock <IChessPiece>();

            chessPieceMock
            .Setup(mock => mock.IsWhite())
            .Returns(true);
            chessPieceMock
            .Setup(mock => mock.PathList)
            .Returns(pathList);

            _board.D5.CurrentChessPiece = chessPieceMock.Object;
            _board.D4.CurrentChessPiece = _blackChessPieceMock.Object;
            _board.D3.CurrentChessPiece = _blackChessPieceMock.Object;
            _board.B5.CurrentChessPiece = _blackChessPieceMock.Object;
            _board.B3.CurrentChessPiece = _blackChessPieceMock.Object;
            var d5 = _board.D5.CurrentChessPiece;
            var d4 = _board.D4.CurrentChessPiece;
            var d3 = _board.D3.CurrentChessPiece;
            var b5 = _board.B5.CurrentChessPiece;
            var b3 = _board.B3.CurrentChessPiece;

            // Act
            await _board.CalculatePossibleSteps();

            CellViewModel.MoveModel(_board.D5, _board.D3);
            CellViewModel.MoveModel(_board.D5, _board.D3);
            CellViewModel.MoveModel(_board.D5, _board.B5);

            // Assert
            Assert.IsNull(_board.D5.CurrentChessPiece,
                          "There is still a ChessPiece on the CellViewModel D5, which should have moved away");
            Assert.AreEqual(_board.D4.CurrentChessPiece, d4, "ChessPiece 'd4' shouldn't be removed");
            Assert.AreEqual(_board.D3.CurrentChessPiece, d3, "ChessPiece 'd3' shouldn't be removed");
            Assert.AreEqual(_board.B3.CurrentChessPiece, b3, "ChessPiece 'b3' did get eaten, but there was no valid Path");
            Assert.AreEqual(_board.B5.CurrentChessPiece, d5, "ChessPiece 'd5' didn't move to the CellViewModel 'B5'");
            Assert.AreEqual(_board.GraveYard.Count, 1, "There where more ChessPieces in the Graveyard than expected");
            Assert.True(_board.GraveYard.Contains(b5), "ChessPiece 'b5' wasn't in the Graveyard, but should have been there");
        }
Beispiel #2
0
        public async void Bishop()
        {
            // Arrange
            _board.A3.CurrentChessPiece = new Bishop(true);
            _board.D4.CurrentChessPiece = new Bishop(false);
            _board.G6.CurrentChessPiece = new Bishop(true);
            _board.A6.CurrentChessPiece = new Bishop(false);

            // Act
            await _board.CalculatePossibleSteps();

            // Assert
            Assert.IsTrue(CellViewModel.MoveModel(_board.A3, _board.D6));
            Assert.IsTrue(CellViewModel.MoveModel(_board.D4, _board.B6));
            Assert.IsTrue(CellViewModel.MoveModel(_board.G6, _board.E4));
            Assert.IsTrue(CellViewModel.MoveModel(_board.A6, _board.C4));
        }