Ejemplo n.º 1
0
        /// <summary>
        /// Diese Methode kümmert sich um das Spielen der Gruppenspiele.
        /// </summary>
        private void PlayMatches()
        {
            bool homeAndAwayMatches = false;

            Console.WriteLine("Do you want to play home and away matches? Press 'Y' for home and away Matches");

            if (Console.ReadKey().Key == ConsoleKey.Y)
            {
                homeAndAwayMatches = true;
            }

            Console.WriteLine("\nPress Enter to start playing.");
            Console.ReadLine();
            Console.Clear();
            CreateMatches();
            ShuffleMatches(AllMatches); // shuffle Matches to have more randomness
            var matchFactory = new MatchFactory();

            foreach (Match match in AllMatches)
            {
                matchFactory.PlayMatch(match);
            }

            //wenn die Rückrunde gespielt wird, sollen die Matches nochmal gespielt werden
            if (homeAndAwayMatches)
            {
                foreach (Match match in AllMatches)
                {
                    matchFactory.ChangeHomeAndAway(match);
                    matchFactory.PlayMatch(match);
                }
            }
        }
Ejemplo n.º 2
0
        public void ChangeHomeAndAway()
        {
            Player playerOne = new Player(new Name("PlayerOne"), new Identification(1));
            Player playerTwo = new Player(new Name("PlayerTwo"), new Identification(2));
            Match  match     = new Match(playerOne, playerTwo);

            var matchFactory = new MatchFactory();

            matchFactory.ChangeHomeAndAway(match);

            Assert.AreEqual(match.PlayerOne, playerTwo);
            Assert.AreEqual(match.PlayerTwo, playerOne);
        }