Example #1
0
        public void CanFetchLastMatch()
        {
            List <string> playerNames = new List <string>()
            {
                "Maru", "Stork", "Taeja", "Rain"
            };

            RoundBase round = tournament.AddBracketRound();

            round.SetPlayersPerGroupCount(2);

            foreach (string playerName in playerNames)
            {
                tournament.RegisterPlayerReference(playerName);
            }

            Match match = round.GetLastMatch();

            match.Group.Should().Be(round.Groups[1]);
            match.Player1.GetName().Should().Be(playerNames[2]);
            match.Player2.GetName().Should().Be(playerNames[3]);
        }
        private static void ConfirmNewStartDateTimeIsAfterAnyMatchInPreviousRound(Match match, DateTime newStartDateTime)
        {
            RoundBase previousRound      = match.Group.Round.GetPreviousRound();
            bool      previousRoundExist = previousRound != null;

            if (previousRoundExist)
            {
                bool newStartDateTimeIsEarlierThanMatchInPreviousRound = newStartDateTime < previousRound.GetLastMatch().StartDateTime;

                if (newStartDateTimeIsEarlierThanMatchInPreviousRound)
                {
                    TournamentIssueReporter tournamentIssueReporter = match.Group.Round.Tournament.TournamentIssueReporter;
                    tournamentIssueReporter.Report(match, TournamentIssues.StartDateTimeIncompatibleWithPreviousRound);
                }
            }
        }