public IEnumerator TestCoinDedectionWithPurchase() { GameObject go = new GameObject(); QueenButton button = go.AddComponent <QueenButton>(); button.button = go.AddComponent <Button>(); BoardManager board = BoardManager.Instance; yield return(null); // Choose a2 Assert.Null(board.Pieces[5, 2]); board.emptySelectionX = 5; board.emptySelectionZ = 2; // It is white's turn and they have sufficient coins board.isWhiteTurn = false; Coin.BlackCoins = 15; button.SpawnAPiece(); // Piece is spawned in selected empty spot Assert.NotNull(board.Pieces[5, 2]); Assert.AreEqual(6, Coin.BlackCoins); }
public IEnumerator TestButtonWillNotSpawnPieceInOccupiedSpot() { GameObject go = new GameObject(); QueenButton button = go.AddComponent <QueenButton>(); button.button = go.AddComponent <Button>(); BoardManager board = BoardManager.Instance; yield return(null); // Choose a2 Assert.NotNull(board.Pieces[0, 1]); board.emptySelectionX = 0; board.emptySelectionZ = 1; Piece original = board.Pieces[0, 1]; // It is white's turn and they have sufficient coins board.isWhiteTurn = true; Coin.WhiteCoins = 9; button.SpawnAPiece(); // Piece is still original pawn and not a new spawned piece Assert.AreEqual(original, board.Pieces[0, 1]); }
public IEnumerator TestQueenButtonSpawnsQueen() { GameObject go = new GameObject(); QueenButton button = go.AddComponent <QueenButton>(); button.button = go.AddComponent <Button>(); BoardManager board = BoardManager.Instance; yield return(null); Assert.Null(board.Pieces[3, 5]); board.emptySelectionX = 3; board.emptySelectionZ = 5; // It is black's turn and they have sufficient coins board.isWhiteTurn = false; Coin.BlackCoins = 9; button.SpawnAPiece(); Assert.IsInstanceOf(typeof(Queen), board.Pieces[3, 5]); }
public IEnumerator TestButtonCanSpawnPieceInEmptySpot() { GameObject go = new GameObject(); QueenButton button = go.AddComponent <QueenButton>(); button.button = go.AddComponent <Button>(); BoardManager board = BoardManager.Instance; yield return(null); // Choose a2 Assert.Null(board.Pieces[0, 2]); board.emptySelectionX = 0; board.emptySelectionZ = 2; // It is white's turn and they have sufficient coins board.isWhiteTurn = true; Coin.WhiteCoins = 9; button.SpawnAPiece(); // Piece is spawned in selected empty spot Assert.NotNull(board.Pieces[0, 2]); }