Ejemplo n.º 1
0
 public WhenATournamentStartsWithTwoDudes()
 {
     _tournament = new Tournament();
     _tournament.AddDude(_dudes[0]);
     _tournament.AddDude(_dudes[1]);
     _tournament = new TournamentService().Start(_tournament);
 }
Ejemplo n.º 2
0
        public WhenTheGameHasAWinnerInATournamentWithTwoDudes()
        {
            _tournament = new Tournament();
            _tournament.AddDude(_dudes[0]);
            _tournament.AddDude(_dudes[1]);

            _game = new Game(_dudes);

            _tournament.AddGame(_game);

            _wonDude = _game.Dudes()[0];

            _tournament = new TournamentService().GameWon(_tournament, _game, _wonDude);
        }
        public WhenTheFirstGameHasAWinnerInATournamentWithThreeDudes()
        {
            _tournament = new Tournament();
            _tournament.AddDude(_dudes[0]);
            _tournament.AddDude(_dudes[1]);
            _tournament.AddDude(_dudes[2]);

            _wonGame    = new Game(_dudes.Take(2));
            _secondGame = new Game(_dudes.Skip(2).Take(1));

            _tournament.AddGame(_wonGame);
            _tournament.AddGame(_secondGame);

            _wonDude = _wonGame.Dudes()[0];

            _tournament = new TournamentService().GameWon(_tournament, _wonGame, _wonDude);
        }
Ejemplo n.º 4
0
        public WhenAGameHasAWinnerInATournamentWithFourDudes()
        {
            _tournament = new Tournament();
            _tournament.AddDude(_dudes[0]);
            _tournament.AddDude(_dudes[1]);
            _tournament.AddDude(_dudes[2]);
            _tournament.AddDude(_dudes[3]);

            _wonGame = new Game(_dudes.Take(2));
            var secondGame = new Game(_dudes.Skip(2).Take(2));

            _tournament.AddGame(_wonGame);
            _tournament.AddGame(secondGame);

            _wonDude = _wonGame.Dudes()[0];

            _tournament = new TournamentService().GameWon(_tournament, _wonGame, _wonDude);
        }
Ejemplo n.º 5
0
        public WhenALargeOddTournamentCompletes()
        {
            _tournament = new Tournament();

            for (int dudeNumber = 1; dudeNumber <= NumberOfDudes; dudeNumber++)
            {
                _tournament.AddDude(new Dude(string.Format("Dude{0}", dudeNumber)));
            }

            var tournamentSvc = new TournamentService();

            _tournament = tournamentSvc.Start(_tournament);

            Game gameToWin;
            int  winner = 0;

            while (null !=
                   (gameToWin = _tournament.Games().Where(game => game.IsInProgress()).FirstOrDefault()))
            {
                winner      = (winner == 0 ? 1 : 0);
                _tournament = tournamentSvc.GameWon(_tournament, gameToWin, gameToWin.Dudes()[winner]);
            }
        }