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