Turn on remaining shogi domain tests.
This commit is contained in:
@@ -216,7 +216,6 @@ namespace Shogi.Domain.UnitTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
// TODO: Consider nesting classes to share this setup in a constructor but have act and assert as separate facts.
|
||||
public void PreventInvalidDrops_MoveSet()
|
||||
{
|
||||
// Arrange
|
||||
@@ -281,79 +280,72 @@ namespace Shogi.Domain.UnitTests
|
||||
// // TODO
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
//public void PreventInvalidDrop_Check()
|
||||
//{
|
||||
// // Arrange
|
||||
// var moves = new[]
|
||||
// {
|
||||
// // P1 Pawn
|
||||
// new Move("C3", "C4"),
|
||||
// // P2 Pawn
|
||||
// new Move("G7", "G6"),
|
||||
// // P1 Pawn, arbitrary move.
|
||||
// new Move("A3", "A4"),
|
||||
// // P2 Bishop takes P1 Bishop
|
||||
// new Move("H8", "B2"),
|
||||
// // P1 Silver takes P2 Bishop
|
||||
// new Move("C1", "B2"),
|
||||
// // P2 Pawn, arbtrary move
|
||||
// new Move("A7", "A6"),
|
||||
// // P1 drop Bishop, place P2 in check
|
||||
// new Move(WhichPiece.Bishop, "G7")
|
||||
// };
|
||||
// var shogi = new Shogi(moves);
|
||||
// shogi.InCheck.Should().Be(WhichPlayer.Player2);
|
||||
// shogi.Player2Hand.Should().ContainSingle(_ => _.WhichPiece == WhichPiece.Bishop);
|
||||
// board["E5"].Should().BeNull();
|
||||
[Fact]
|
||||
public void PreventInvalidDrop_Check()
|
||||
{
|
||||
// Arrange
|
||||
var shogi = MockShogiBoard();
|
||||
// P1 Pawn
|
||||
shogi.Move("C3", "C4", false);
|
||||
// P2 Pawn
|
||||
shogi.Move("G7", "G6", false);
|
||||
// P1 Pawn, arbitrary move.
|
||||
shogi.Move("A3", "A4", false);
|
||||
// P2 Bishop takes P1 Bishop
|
||||
shogi.Move("H8", "B2", false);
|
||||
// P1 Silver takes P2 Bishop
|
||||
shogi.Move("C1", "B2", false);
|
||||
// P2 Pawn, arbtrary move
|
||||
shogi.Move("A7", "A6", false);
|
||||
// P1 drop Bishop, place P2 in check
|
||||
shogi.Move(WhichPiece.Bishop, "G7");
|
||||
|
||||
// // Act - P2 places a Bishop while in check.
|
||||
// var dropSuccess = shogi.Move(new Move(WhichPiece.Bishop, "E5"));
|
||||
shogi.BoardState.InCheck.Should().Be(WhichPlayer.Player2);
|
||||
shogi.BoardState.Player2Hand.Should().ContainSingle(_ => _.WhichPiece == WhichPiece.Bishop);
|
||||
shogi.BoardState["E5"].Should().BeNull();
|
||||
|
||||
// // Assert
|
||||
// dropSuccess.Should().BeFalse();
|
||||
// board["E5"].Should().BeNull();
|
||||
// shogi.InCheck.Should().Be(WhichPlayer.Player2);
|
||||
// shogi.Player2Hand.Should().ContainSingle(_ => _.WhichPiece == WhichPiece.Bishop);
|
||||
//}
|
||||
// Act - P2 places a Bishop while in check.
|
||||
shogi.Move(WhichPiece.Bishop, "E5");
|
||||
|
||||
//[Fact]
|
||||
//public void PreventInvalidDrop_Capture()
|
||||
//{
|
||||
// // Arrange
|
||||
// var moves = new[]
|
||||
// {
|
||||
// // P1 Pawn
|
||||
// new Move("C3", "C4"),
|
||||
// // P2 Pawn
|
||||
// new Move("G7", "G6"),
|
||||
// // P1 Bishop capture P2 Bishop
|
||||
// new Move("B2", "H8"),
|
||||
// // P2 Pawn
|
||||
// new Move("G6", "G5")
|
||||
// };
|
||||
// var shogi = new Shogi(moves);
|
||||
// using (new AssertionScope())
|
||||
// {
|
||||
// shogi.Player1Hand.Should().ContainSingle(_ => _.WhichPiece == WhichPiece.Bishop);
|
||||
// board["I9"].Should().NotBeNull();
|
||||
// board["I9"].WhichPiece.Should().Be(WhichPiece.Lance);
|
||||
// board["I9"].Owner.Should().Be(WhichPlayer.Player2);
|
||||
// }
|
||||
// Assert
|
||||
shogi.BoardState["E5"].Should().BeNull();
|
||||
shogi.BoardState.InCheck.Should().Be(WhichPlayer.Player2);
|
||||
shogi.BoardState.Player2Hand.Should().ContainSingle(_ => _.WhichPiece == WhichPiece.Bishop);
|
||||
}
|
||||
|
||||
// // Act - P1 tries to place a piece where an opponent's piece resides.
|
||||
// var dropSuccess = shogi.Move(new Move(WhichPiece.Bishop, "I9"));
|
||||
[Fact]
|
||||
public void PreventInvalidDrop_Capture()
|
||||
{
|
||||
// Arrange
|
||||
var shogi = MockShogiBoard();
|
||||
// P1 Pawn
|
||||
shogi.Move("C3", "C4", false);
|
||||
// P2 Pawn
|
||||
shogi.Move("G7", "G6", false);
|
||||
// P1 Bishop capture P2 Bishop
|
||||
shogi.Move("B2", "H8", false);
|
||||
// P2 Pawn
|
||||
shogi.Move("G6", "G5", false);
|
||||
using (new AssertionScope())
|
||||
{
|
||||
shogi.BoardState.Player1Hand.Should().ContainSingle(_ => _.WhichPiece == WhichPiece.Bishop);
|
||||
shogi.BoardState["I9"].Should().NotBeNull();
|
||||
shogi.BoardState["I9"]!.WhichPiece.Should().Be(WhichPiece.Lance);
|
||||
shogi.BoardState["I9"]!.Owner.Should().Be(WhichPlayer.Player2);
|
||||
}
|
||||
|
||||
// // Assert
|
||||
// using (new AssertionScope())
|
||||
// {
|
||||
// dropSuccess.Should().BeFalse();
|
||||
// shogi.Player1Hand.Should().ContainSingle(_ => _.WhichPiece == WhichPiece.Bishop);
|
||||
// board["I9"].Should().NotBeNull();
|
||||
// board["I9"].WhichPiece.Should().Be(WhichPiece.Lance);
|
||||
// board["I9"].Owner.Should().Be(WhichPlayer.Player2);
|
||||
// }
|
||||
//}
|
||||
// Act - P1 tries to place a piece where an opponent's piece resides.
|
||||
shogi.Move(WhichPiece.Bishop, "I9");
|
||||
|
||||
// Assert
|
||||
using (new AssertionScope())
|
||||
{
|
||||
shogi.BoardState.Player1Hand.Should().ContainSingle(_ => _.WhichPiece == WhichPiece.Bishop);
|
||||
shogi.BoardState["I9"].Should().NotBeNull();
|
||||
shogi.BoardState["I9"]!.WhichPiece.Should().Be(WhichPiece.Lance);
|
||||
shogi.BoardState["I9"]!.Owner.Should().Be(WhichPlayer.Player2);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Check()
|
||||
|
||||
Reference in New Issue
Block a user