protected IPlayer AddPlayer() { var player = new Player("player") { Id = new Guid().ToString() }; this._playingTable.AddPlayer(player); var addedPlayer = this._playingTable.Players[0]; return addedPlayer; }
public void AddNewPlayer_WhenTheIsFreeSpace() { // Arrange var player = new Player("player"); // Act this._playingTable.AddPlayer(player); var addedPlayer = this._playingTable.Players[0]; // Assert Assert.AreSame(player, addedPlayer); }
public void RemovesThePlayerFromTheList() { // Arrange var player = new Player("player"); this._playingTable.AddPlayer(player); // Act this._playingTable.RemovePlayer(player); var isInTheList = this._playingTable.Players.Contains(player); // Assert Assert.IsFalse(isInTheList); }
/// <summary> /// Add the player to the game /// </summary> /// <param name="name">The user name entered by the user</param> /// <param name="playerId">The connection id of the player</param> public void JoinGame(string name, string playerId) { if (string.IsNullOrEmpty(name)) { throw new InvalidOperationException("The player needs to provide a name"); } var newPlayer = new Player(name) { Id = playerId }; this.GamePlayers.Add( newPlayer ); }