public void GivenACasinoWithATableWithOnePlayer_WhenRemovePlayer_ThenThatTableIsRemoved() { var casino = new Casino(); var id = casino.CreateTable(); var table = casino.GetTable(id); table.AddPlayer("Phil"); casino.RemovePlayer("Phil"); casino.GetTable(id).Should().BeNull(); }
public void GivenACasino_WhenRemovePlayerThatDoesNotExist_ThenNothingHappens() { var casino = new Casino(); var id = casino.CreateTable(); casino.GetTable(id).AddPlayer("Daniel"); casino.RemovePlayer("Phil"); var table = casino.GetTable(id); table.Should().NotBeNull(); }
public void GivenACasinoWithATableWithMultiplePlayers_WhenRemovePlayer_ThenThePlayerIsRemovedButNotTheTable() { var casino = new Casino(); var id = casino.CreateTable(); casino.GetTable(id).AddPlayer("Phil"); casino.GetTable(id).AddPlayer("Daniel"); casino.RemovePlayer("Phil"); var table = casino.GetTable(id); table.Should().NotBeNull(); var status = table.GetStatus(); status.Players.Should().HaveCount(1); status.Players.Should().Contain(p => p.Name == "Daniel"); }
public override Task OnDisconnectedAsync(Exception exception) { _casino.RemovePlayer(Context.ConnectionId); return base.OnDisconnectedAsync(exception); }