private void StartGame() { _gameService.ClearPlayers(); _gameService.CreateCardPlayers((int)CardPlayersInput.Value); _gameService.CreateDicePlayers((int)DicePlayersInput.Value, _rollResultChances); _gameService.CreateCardDicePlayers((int)CardDicePlayersInput.Value, _rollResultChances); if (_gameService.CanStartGame()) { _players = _gameService.GetPlayers(); var counter = 0; var x = 196; var y = 60; foreach (var player in _players) { counter++; PictureBox picture = new PictureBox { Name = player.FullName, Size = new Size(100, 150), SizeMode = PictureBoxSizeMode.StretchImage, Location = new Point(x, y), Visible = true, }; picture.MouseClick += new MouseEventHandler(player_Click); Label lbl = new Label { Text = player.FullName, ForeColor = Color.Black, Location = new Point(x, picture.Height + y), Height = 50, Width = 100, TextAlign = ContentAlignment.MiddleCenter }; picture.ImageLocation = @"Content\Images\player.jpg"; Controls.Add(picture); Controls.Add(lbl); if (counter % 5 == 0) { x = 196; y += 210; } else { x += 108; } } } else { MessageBox.Show("Ανώτατο όριο 15 παικτών. Παρακαλώ μειώστε το σύνολο των παικτών."); } }
public void Can_Not_Create_Game_With_More_Than_15_players() { _deckersMeeting.CreateDicePlayers(24, 3, 5); Assert.IsTrue(_deckersMeeting.CanStartGame() == false); }