public IEnumerator TestRookButtonSpawnsRook() { GameObject go = new GameObject(); RookButton button = go.AddComponent <RookButton>(); button.button = go.AddComponent <Button>(); BoardManager board = BoardManager.Instance; yield return(null); Assert.Null(board.Pieces[3, 2]); board.emptySelectionX = 3; board.emptySelectionZ = 2; board.isWhiteTurn = true; Coin.WhiteCoins = 5; button.SpawnAPiece(); Assert.IsInstanceOf(typeof(Rook), board.Pieces[3, 2]); }
public IEnumerator TestButtonWillNotSpawnWithoutEnoughCoins() { GameObject go = new GameObject(); RookButton button = go.AddComponent <RookButton>(); button.button = go.AddComponent <Button>(); BoardManager board = BoardManager.Instance; yield return(null); // Choose a3 Assert.Null(board.Pieces[0, 2]); board.emptySelectionX = 0; board.emptySelectionZ = 2; // It is white's turn and they do not have sufficient coins board.isWhiteTurn = true; Coin.WhiteCoins = 0; button.SpawnAPiece(); Assert.Null(board.Pieces[0, 2]); }