Exemple #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);
        }
Exemple #2
0
 public void AddDude(Dude dude)
 {
     _dudes.Add(dude);
 }
Exemple #3
0
 public void MarkWinner(Dude winner)
 {
     _winner = winner;
 }
Exemple #4
0
 internal void MarkWinner(Dude dude)
 {
     _winner = dude;
 }