private int CreateTable(RemoteTcpServer serverEntity)
        {
            var cmd = new CreateTableCommand()
            {
                Params = new TableParams()
                {
                    //Blind = BlindTypeEnum.Blinds,
                    Options = new GameTypeOptionsStandard(),
                    //GameSize = 10,
                    //Limit = LimitTypeEnum.NoLimit,
                    Lobby = new LobbyOptionsQuickMode()
                    {
                        //StartingAmount = 1500
                    },
                    MaxPlayers        = 10,
                    MinPlayersToStart = 2,
                    TableName         = "Table One",
                    Variant           = GameSubTypeEnum.Standard,
                    WaitingTimes      = new ConfigurableWaitingTimes()
                    {
                        //AfterBoardDealed = 0,
                        AfterPlayerAction = 0,
                        //AfterPotWon = 0
                    }
                }
            };

            serverEntity.Send(cmd);
            var response = serverEntity.WaitForNextCommand <CreateTableResponse>();

            Assert.AreNotEqual(response.IdTable, -1);
            return(response.IdTable);
        }
        private int GameIsStarting(RemoteTcpServer serverEntity)
        {
            var response = serverEntity.WaitForNextCommand <GameStartedCommand>();

            Assert.AreNotEqual(0, response.NeededBlindAmount);
            return(response.NeededBlindAmount);
        }
        private void BeAwareOfMoneyPlayed(RemoteTcpServer serverEntity, int tableId, int seat)
        {
            var responseTurnEnded = serverEntity.WaitForNextCommand <PlayerTurnEndedCommand>();

            Assert.AreEqual(tableId, responseTurnEnded.TableId);
            Assert.AreEqual(seat, responseTurnEnded.NoSeat);
        }
        private void BeAwareOfBettingRoundStarted(RemoteTcpServer serverEntity, int tableId, int round)
        {
            var response = serverEntity.WaitForNextCommand <BetTurnStartedCommand>();

            Assert.AreEqual(tableId, response.TableId);
            Assert.AreEqual(round, response.BettingRoundId);
        }
        private void BeAwareOfWhoItIsToPlay(RemoteTcpServer serverEntity, int tableId, int noSeat)
        {
            var response = serverEntity.WaitForNextCommand <PlayerTurnBeganCommand>();

            Assert.AreEqual(tableId, response.TableId);
            Assert.AreEqual(noSeat, response.NoSeat);
        }
        private void BeAwareOfOtherPlayerSatIn(RemoteTcpServer serverEntity, int tableId, RemoteTcpServer other, int noSeat)
        {
            var response = serverEntity.WaitForNextCommand <SeatUpdatedCommand>();

            Assert.AreEqual(other.Name, response.Seat.Player.Name);
            Assert.AreEqual(tableId, response.TableId);
            Assert.AreEqual(noSeat, response.Seat.NoSeat);
        }
        private void BeAwareOfOtherPlayerJoined(RemoteTcpServer serverEntity, RemoteTcpServer other)
        {
            var response = serverEntity.WaitForNextCommand <GameMessageCommand>();

            Assert.AreEqual(GameMessageEnum.PlayerJoined, response.Info.OptionType);
            var info = (GameMessageOptionPlayerJoined)response.Info;

            Assert.AreEqual(other.Name, info.PlayerName);
        }
        private void JoinUnjoinableTable(RemoteTcpServer serverEntity, int table)
        {
            var cmd = new JoinTableCommand()
            {
                TableId = table
            };

            serverEntity.Send(cmd);
            var response = serverEntity.WaitForNextCommand <JoinTableResponse>();

            Assert.IsFalse(response.Success);
        }
        private void BeAwareOfHoleCardDistribution(RemoteTcpServer serverEntity, int tableId, params int[] seats)
        {
            HashSet <int> remaining = new HashSet <int>(seats);

            while (remaining.Any())
            {
                var response = serverEntity.WaitForNextCommand <PlayerHoleCardsChangedCommand>();
                Assert.AreEqual(tableId, response.TableId);
                Assert.IsTrue(remaining.Contains(response.NoSeat));
                remaining.Remove(response.NoSeat);
            }
        }
        private void IdentifyAs(RemoteTcpServer serverEntity, string name)
        {
            var cmd = new IdentifyCommand()
            {
                Name = name
            };

            serverEntity.Send(cmd);
            var response = serverEntity.WaitForNextCommand <IdentifyResponse>();

            Assert.IsTrue(response.Success);
            serverEntity.Name = name;
        }
        private int SitInSeat(RemoteTcpServer serverEntity, int tableId, int noSeat)
        {
            var cmd = new PlayerSitInCommand()
            {
                TableId     = tableId,
                MoneyAmount = 1500,
                NoSeat      = noSeat
            };

            serverEntity.Send(cmd);
            var response = serverEntity.WaitForNextCommand <PlayerSitInResponse>();

            Assert.AreEqual(noSeat, response.NoSeat);
            return(noSeat);
        }