Beispiel #1
0
        public Tournament GameWon(Tournament tournament, Game wonGame, Dude dudeWhoWon)
        {
            wonGame.MarkWinner(dudeWhoWon);
            var openGame = tournament.Games().FirstOrDefault(game => game.IsOpen());

            if (openGame != null)
            {
                openGame.AddDude(dudeWhoWon);
            }
            else if (tournament.Games().Any(game => game.IsInProgress()))
            {
                tournament.AddGame(new Game(new Dude[] { dudeWhoWon }));
            }
            else if (tournament.Games().All(game => game.IsCompleted()))
            {
                tournament.MarkWinner(dudeWhoWon);
            }

            return(tournament);
        }
Beispiel #2
0
 public void AddDude(Dude dude)
 {
     _dudes.Add(dude);
 }
Beispiel #3
0
 public void MarkWinner(Dude winner)
 {
     _winner = winner;
 }
Beispiel #4
0
 internal void MarkWinner(Dude dude)
 {
     _winner = dude;
 }