private void PlaceNumbersTestInternal(PlayPlaces places, int maxPlaces) { AddPlayers(places, maxPlaces); CheckPlaceNumbers(places); var player = places.Players.First().Player; places.RemovePlayer(player); CheckPlaceNumbers(places); places.PlantPlayer(player); places.RemovePlayer(GetMiddlePlayer(places)); CheckPlaceNumbers(places); }
private void RemoveAllPlayers(PlayPlaces places) { while (places.Players.Count > 0) { places.RemovePlayer(places.Players.Last().Player); } }
private void AddAndRemovePlayersTestInternal(PlayPlaces places, int maxPlaces) { AddPlayers(places, maxPlaces); Assert.Equal(maxPlaces, places.Players.Count); Assert.True(places.IsFull); Assert.Throws <TrueFalseGameException>(() => { places.PlantPlayer(new Player(Guid.NewGuid(), "Test")); }); var player = places.Players.Last().Player; Assert.Throws <TrueFalseGameException>(() => { places.PlantPlayer(player); }); places.RemovePlayer(player); Assert.Equal(maxPlaces - 1, places.Players.Count); Assert.Null(places.Players.FirstOrDefault(p => p.Player.Id == player.Id)); player = places.Players.Last().Player; Assert.Throws <TrueFalseGameException>(() => { places.PlantPlayer(player); }); RemoveAllPlayers(places); Assert.Equal(0, places.Players.Count); Assert.Throws <TrueFalseGameException>(() => { places.RemovePlayer(player); }); }