Beispiel #1
0
        public void ShouldCreateTeamRankingsFromSeason()
        {
            var season = new Season(null, "My Season", 1, null, null, null, null, true, false, 1, null);

            CreateSeasonDivisions(season);
            CreateSeasonTeams(season);
            CreateSeasonRankings(season);

            var playoffConfig = new PlayoffCompetitionConfig();
            var playoff       = new Playoff()
            {
                Year = 15
            };

            playoffConfig.CopyTeamsFromCompetition(playoff, season);
            playoffConfig.CopyRankingsFromCompetition(playoff, season);
            var newRankings = playoff.Rankings;

            StrictEqual(12, newRankings.Where(r => r.GroupName.Equals("NHL")).Count());
            StrictEqual(4, newRankings.Where(r => r.GroupName.Equals("East")).Count());
            StrictEqual(4, newRankings.Where(r => r.GroupName.Equals("West")).Count());
            StrictEqual(4, newRankings.Where(r => r.GroupName.Equals("Central")).Count());

            Single(newRankings.Where(r => r.GroupName.Equals("NHL") && r.Rank == 5 && r.CompetitionTeam.Name.Equals("Team 1")));
            Single(newRankings.Where(r => r.GroupName.Equals("East") && r.Rank == 2 && r.CompetitionTeam.Name.Equals("Team 1")));

            Single(newRankings.Where(r => r.GroupName.Equals("NHL") && r.Rank == 10 && r.CompetitionTeam.Name.Equals("Team 5")));
            Single(newRankings.Where(r => r.GroupName.Equals("West") && r.Rank == 4 && r.CompetitionTeam.Name.Equals("Team 5")));
        }
Beispiel #2
0
        public void ShouldExerciseCompetitionTeamRepositoryNHibernate()
        {
            var repo     = new CompetitionTeamRepository(new RepositoryNHibernate <CompetitionTeam>());
            var compRepo = new CompetitionRepository(new RepositoryNHibernate <Competition>());

            var comp1 = new Season(null, "Season 1", 1, null, null, null, null, false, false, 1, null);
            var comp2 = new Playoff(null, "Playoff 1", 1, 1, null, null, null, null, false, false, 1, null);

            compRepo.Update(comp1);
            compRepo.Update(comp2);

            for (int i = 0; i < 10; i++)
            {
                var syt = new CompetitionTeam(comp1, null, "Team " + i, null, null, 5, null, 1, null);
                repo.Update(syt);
            }

            for (int i = 0; i < 5; i++)
            {
                var syt = new CompetitionTeam(comp2, null, "Team " + (i * 100), null, null, 5, null, 1, null);
                repo.Update(syt);
            }

            //can we get them all?
            var teams = repo.GetAll().ToList();
            var test  = teams.Where(t => t.Competition.Id == comp1.Id).ToList();

            StrictEqual(15, teams.Count);
            teams = repo.GetByCompetition(comp1).ToList();
            StrictEqual(10, teams.Count());
            teams = repo.GetByCompetition(comp2).ToList();
            StrictEqual(5, teams.Count());
        }
Beispiel #3
0
        public void ShouldCreateGameProperly(int testNo, int gameToTest, int[] homeTeamProgression, int expectedResult)
        {
            var number = testNo;

            var gameRules     = new GameRules("Test", false, 1, 3, 10, true);
            var playoffConfig = new PlayoffCompetitionConfig("My Playoff", null, 1, 55, gameRules, 1, null, null, null, null, null); //todo eventually can't use this constructor
            var playoff       = new Playoff(playoffConfig, "My Playoff", 1, 1, null, null, null, null, true, false, 1, null);

            playoff.CompetitionConfig = playoffConfig;
            playoffConfig.GameRules   = gameRules;

            var homeTeam = CreateTeam("A Team", 1, 1);
            var awayTeam = CreateTeam("B Team", 1, 1);

            var series = new BestOfSeries(playoff, "Test", 1, 1, homeTeam, awayTeam, 0, 0, 0, null, homeTeamProgression);

            var game = series.CreateGameForSeries(gameToTest);

            if (expectedResult == 0)
            {
                Equal("A Team", game.Home.Name);
                Equal("B Team", game.Away.Name);
            }
            else
            {
                Equal("B Team", game.Home.Name);
                Equal("A Team", game.Away.Name);
            }
        }
Beispiel #4
0
        public static IEnumerable <object[]> PlayoffDataForGetTeamByRuleTests()
        {
            var config  = new PlayoffCompetitionConfig("My Playoff", null, 1, 12, null, 1, null, null, null, null, null);
            var playoff = new Playoff(null, null, 1, 1, new List <PlayoffSeries>(), new List <CompetitionTeam>(), null, new List <TeamRanking>(), true, false, 1, null);

            playoff.CompetitionConfig = config;

            for (int i = 0; i < 10; i++)
            {
                var name = "Team " + i;
                playoff.Teams.Add(CreateTeam(name, i, i));
                playoff.Rankings.Add(new TeamRanking(i + 1, "R1", playoff.Teams.Where(t => t.Name.Equals(name)).First(), 1));
            }

            var gameRules = new GameRules("Rule 1", false, 0, 3, 10, true);

            var seriesA = new BestOfSeries(playoff, "Series A", 2, 15, (PlayoffTeam)playoff.Teams.Where(t => t.Name.Equals("Team 1")).First(), (PlayoffTeam)playoff.Teams.Where(t => t.Name.Equals("Team 2")).First(), 4, 3, 4, null, null);

            playoff.Series.Add(seriesA);

            //need to add series to get teams from
            yield return(new object[] { 1, playoff, new PlayoffSeriesRule(config, "Series 1", 1, PlayoffSeriesRule.Type.BestOf, 4, gameRules, "R1", 1, "R1", 10, 1, null, new int[] { 0, 0, 0, 1, 1, 1 }, null, null, null, null), "Team 0", "Team 9" });

            yield return(new object[] { 1, playoff, new PlayoffSeriesRule(config, "Series 1", 1, PlayoffSeriesRule.Type.BestOf, 4, gameRules, "R1", 4, "R1", 2, 1, null, new int[] { 0, 0, 0, 1, 1, 1 }, null, null, null, null), "Team 3", "Team 1" });
            //todo add get from ranking rule
        }
Beispiel #5
0
        public void ShouldExerciseTeamRankingRepositoryNHibernate()
        {
            var compRepo = new CompetitionRepository(new RepositoryNHibernate <Competition>());
            var repo     = new TeamRankingRepository(new RepositoryNHibernate <TeamRanking>());

            var comp1 = new Season(null, "Season 1", 1, null, null, null, null, false, false, 1, null);
            var comp2 = new Playoff(null, "Playoff 1", 1, 1, null, null, null, null, false, false, 1, null);

            compRepo.Update(comp1);
            compRepo.Update(comp2);

            for (int i = 0; i < 10; i++)
            {
                var ranking = new TeamRanking(1, "Group 1", new CompetitionTeam(comp1, null, "Team " + (i * 10), null, null, 5, null, 1, null), 1);
                repo.Update(ranking);
            }

            for (int i = 0; i < 5; i++)
            {
                var ranking = new TeamRanking(1, "Group 5", new CompetitionTeam(comp2, null, "Team " + (i * 100), null, null, 5, null, 1, null), 1);
                repo.Update(ranking);
            }

            var rankings = repo.GetByCompetition(comp1.Id);

            StrictEqual(10, rankings.Count());
            rankings = repo.GetByCompetition(comp2.Id);
            StrictEqual(5, rankings.Count());
        }
Beispiel #6
0
 public BestOfSeries(Playoff playoff, string name, int round, int startingDay, PlayoffTeam homeTeam, PlayoffTeam awayTeam,
                     int homeWins, int awayWins, int requiredWins, List <PlayoffGame> games, int[] homeGameProgression)
     : base(playoff, name, round, startingDay, homeTeam, awayTeam, games, homeGameProgression)
 {
     HomeWins     = homeWins;
     AwayWins     = awayWins;
     RequiredWins = requiredWins;
 }
        //need to test out the time period
        public virtual void ProcessSeriesRules(Playoff playoff)
        {
            playoff.Series = new List <PlayoffSeries>();

            GetActiveSeriesRules(playoff.Year).ToList().ForEach(rule =>
            {
                playoff.Series.Add(SetupSeriesFromRule(playoff, rule));
            });
        }
        public virtual PlayoffSeries SetupSeriesFromRule(Playoff playoff, PlayoffSeriesRule rule)
        {
            var homeTeam = GetTeamByRule(playoff, rule.HomeFromName, rule.HomeFromValue);
            var awayTeam = GetTeamByRule(playoff, rule.AwayFromName, rule.AwayFromValue);

            var series = SetupSeries(playoff, rule.SeriesType, rule.Name, rule.Round, -1, homeTeam, awayTeam, rule.SeriesNumber, rule.HomeGameProgression);

            return(series);
        }
Beispiel #9
0
 private void CreatePlayoffRankings(Playoff playoffs)
 {
     playoffs.Rankings = new List <TeamRanking>()
     {
         new TeamRanking(1, "Top Seeds", (PlayoffTeam)playoffs.Teams[0], 1),
         new TeamRanking(2, "Top Seeds", (PlayoffTeam)playoffs.Teams[1], 1),
         new TeamRanking(3, "Top Seeds", (PlayoffTeam)playoffs.Teams[2], 1),
         new TeamRanking(6, "NHL", (PlayoffTeam)playoffs.Teams[5], 1),
     };
 }
Beispiel #10
0
 public TotalGoalsSeries(Playoff playoff, string name, int round, int startingDay, PlayoffTeam homeTeam, PlayoffTeam awayTeam,
                         int homeScore, int awayScore, int minimumGames, int gamesPlayed,
                         List <PlayoffGame> games, int[] homeGameProgression)
     : base(playoff, name, round, startingDay, homeTeam, awayTeam, games, homeGameProgression)
 {
     HomeScore    = homeScore;
     AwayScore    = awayScore;
     GamesPlayed  = gamesPlayed;
     MinimumGames = minimumGames;
 }
Beispiel #11
0
        public void ShouldCreateTeamRankingsFromAllRules()
        {
            var season        = new Season(null, "My Season", 1, null, null, null, null, true, false, 1, null);
            var playoffConfig = new PlayoffCompetitionConfig();
            var playoff       = new Playoff()
            {
                Year = 15
            };

            CreateSeasonDivisions(season);
            CreateSeasonTeams(season);
            CreateSeasonRankings(season);
            CreateRankingRules(playoffConfig);

            playoffConfig.CopyTeamsFromCompetition(playoff, season);
            playoffConfig.CopyRankingsFromCompetition(playoff, season);
            playoffConfig.ProcessRankingRules(playoff);

            var topSeeds    = playoff.Rankings.Where(r => r.GroupName.Equals("Top Seeds"));
            var restOfTeams = playoff.Rankings.Where(r => r.GroupName.Equals("RemainingTeams"));
            var combined    = playoff.Rankings.Where(r => r.GroupName.Equals("Combined"));

            StrictEqual(3, topSeeds.Count());
            StrictEqual(9, restOfTeams.Count());
            StrictEqual(7, combined.Count());

            var seedName  = topSeeds.Select(r => r.CompetitionTeam.Name).ToList();
            var restNames = restOfTeams.Select(r => r.CompetitionTeam.Name).ToList();

            StrictEqual(0, seedName.Where(r => restNames.Contains(r)).ToList().Count());
            StrictEqual(9, restNames.Count);

            Equal("Team 6", topSeeds.Where(r => r.Rank == 1).First().CompetitionTeam.Name);
            Equal("Team 10", topSeeds.Where(r => r.Rank == 2).First().CompetitionTeam.Name);
            Equal("Team 2", topSeeds.Where(r => r.Rank == 3).First().CompetitionTeam.Name);

            Equal("Team 7", restOfTeams.Where(r => r.Rank == 1).First().CompetitionTeam.Name);
            Equal("Team 1", restOfTeams.Where(r => r.Rank == 2).First().CompetitionTeam.Name);
            Equal("Team 11", restOfTeams.Where(r => r.Rank == 3).First().CompetitionTeam.Name);
            Equal("Team 9", restOfTeams.Where(r => r.Rank == 4).First().CompetitionTeam.Name);
            Equal("Team 8", restOfTeams.Where(r => r.Rank == 5).First().CompetitionTeam.Name);
            Equal("Team 12", restOfTeams.Where(r => r.Rank == 6).First().CompetitionTeam.Name);
            Equal("Team 5", restOfTeams.Where(r => r.Rank == 7).First().CompetitionTeam.Name);
            Equal("Team 4", restOfTeams.Where(r => r.Rank == 8).First().CompetitionTeam.Name);
            Equal("Team 3", restOfTeams.Where(r => r.Rank == 9).First().CompetitionTeam.Name);

            Equal("Team 6", combined.Where(r => r.Rank == 1).First().CompetitionTeam.Name);
            Equal("Team 10", combined.Where(r => r.Rank == 2).First().CompetitionTeam.Name);
            Equal("Team 9", combined.Where(r => r.Rank == 3).First().CompetitionTeam.Name);
            Equal("Team 8", combined.Where(r => r.Rank == 4).First().CompetitionTeam.Name);
            Equal("Team 12", combined.Where(r => r.Rank == 5).First().CompetitionTeam.Name);
            Equal("Team 5", combined.Where(r => r.Rank == 6).First().CompetitionTeam.Name);
            Equal("Team 4", combined.Where(r => r.Rank == 7).First().CompetitionTeam.Name);
        }
        public virtual PlayoffTeam GetTeamByRule(Playoff playoff, string fromName, int fromValue)
        {
            var rankingsForGroup = playoff.Rankings.Where(r => r.GroupName == fromName).ToList();

            if (rankingsForGroup.Count > 0)
            {
                var ranking = rankingsForGroup.Where(r => r.Rank == fromValue).ToList().First();
                return((PlayoffTeam)ranking.CompetitionTeam);
            }
            return(null);
        }
Beispiel #13
0
        public Playoff CreatePlayoff(IList <ICompetition> ParentCompetitions, int number, int year, int startingDay, PlayoffGameCreator gameCreator)
        {
            var playoff = new Playoff()
            {
                GameCreator = gameCreator, Year = year, Number = number, Name = PlayoffName, StartingDay = startingDay
            };

            InitialGroupRules.ToList().ForEach(groupRule =>
            {
                groupRule.AddTeamsFromRuleToCompetition(ParentCompetitions.Where(p => p.Name.Equals(groupRule.FromCompetitionName)).First(), playoff);
            });
        }
Beispiel #14
0
        public void ShouldGetTeamFromRule(int testNo, Playoff p, PlayoffSeriesRule rule, string expectedHomeName, string expectedAwayName)
        {
            var number = testNo;

            var playoffConfig = (PlayoffCompetitionConfig)p.CompetitionConfig;

            var homeTeam = playoffConfig.GetTeamByRule(p, rule.HomeFromName, rule.HomeFromValue);
            var awayTeam = playoffConfig.GetTeamByRule(p, rule.AwayFromName, rule.AwayFromValue);

            Equal(expectedHomeName, homeTeam.Name);
            Equal(expectedAwayName, awayTeam.Name);
        }
Beispiel #15
0
        public static Event GetEventInfoFromJson(string json, Event e = null)
        {
            var game         = Api.GetGameObject(json);
            int numberOfEnds = 8;

            int.TryParse(game.numberOfEnds, out numberOfEnds);
            Guid           eventId     = Guid.NewGuid();
            EventFormat    eventFormat = GetEventFormat([email protected]);
            Standings      standings   = null;
            List <Bracket> brackets    = null;

            if (eventFormat == EventFormat.ROUND_ROBIN)
            {
                standings = GetEventStandings([email protected]);
            }
            else if (eventFormat == EventFormat.KNOCKOUT)
            {
                brackets = GetBrackets([email protected]);
            }
            Playoff playoff = GetPlayoff([email protected]);

            //TODO More robust parsing for dates in case of error.
            if (e == null)
            {
                e = new Event(
                    [email protected],
                    DateTime.Parse([email protected]),
                    DateTime.Parse([email protected]),
                    [email protected],
                    new EventType(GetTeamTypeFromDivision([email protected]), numberOfEnds, eventId, eventFormat),
                    czId: [email protected],
                    eventId: eventId,
                    standings: standings,
                    brackets: brackets,
                    playoff: playoff
                    );
            }
            else
            {
                e.Name      = [email protected];
                e.StartDate = DateTime.Parse([email protected]);
                e.EndDate   = DateTime.Parse([email protected]);
                e.Location  = [email protected];
                e.Type.SetTeamType(GetTeamTypeFromDivision([email protected]));
                e.Type.NumberOfEnds = numberOfEnds;
                e.Type.EventFormat  = eventFormat;
                e.Standings         = standings;
                e.Brackets          = brackets;
                e.Playoff           = playoff;
            }
            return(e);
        }
Beispiel #16
0
        public void TestMethod3()
        {
            double[,] newMatrix = { { 5, 1 },
                                    { 4, 2 },
                                    { 2, 3 }, };
            Playoff playoff = new Playoff(newMatrix);
            Risk    risk    = Converter.fromPlayoffToRisk(playoff);

            double[] currentState = { 0.6, 0.2 };


            Assert.AreEqual(false, risk.addStateOfNature(currentState));
        }
Beispiel #17
0
        public void GetPlayoffTest(string czId, bool isNull)
        {
            Playoff playoff = Parser.GetPlayoff(czId);

            if (isNull)
            {
                Xunit.Assert.Equal(null, playoff);
                return;
            }
            string html = playoff.Html;

            Xunit.Assert.True(Utility.ValidatePlayoffHtml(html));
        }
Beispiel #18
0
        public void TestMethod2()
        {
            double[,] newMatrix = { { 5, 1 },
                                    { 4, 2 },
                                    { 2, 3 }, };
            Playoff playoff = new Playoff(newMatrix);
            Risk    risk    = Converter.fromPlayoffToRisk(playoff);

            double[] currentState = { 0.6, 0.4 };
            risk.addStateOfNature(currentState);
            risk.findMaxExperimentPrice();

            Assert.AreEqual(0.8, risk.MaxExperiment);
        }
        //need to  test out the time period
        public virtual void ProcessRankingRulesAndAddTeams(Playoff playoff, IList <Competition> parents)
        {
            //setup rankings based on each competition to use later on in the series
            if (parents != null)
            {
                parents.ToList().ForEach(comp =>
                {
                    CopyTeamsFromCompetition(playoff, comp);
                    CopyRankingsFromCompetition(playoff, comp);
                });
            }

            ProcessRankingRules(playoff);
        }
        public virtual PlayoffSeries SetupSeries(Playoff playoff, PlayoffSeriesRule.Type seriesType, string name, int round, int startingDay, PlayoffTeam homeTeam, PlayoffTeam awayTeam,
                                                 int seriesNumber, int[] homeGameProgression)
        {       //if it is not setup, create it
            switch (seriesType)
            {
            case PlayoffSeriesRule.Type.BestOf:
                return(new BestOfSeries(playoff, name, round, startingDay, homeTeam, awayTeam, 0, 0, seriesNumber, new List <PlayoffGame>(), homeGameProgression));

            case PlayoffSeriesRule.Type.TotalGoals:
                return(new TotalGoalsSeries(playoff, name, round, startingDay, homeTeam, awayTeam, 0, 0, seriesNumber, 0, new List <PlayoffGame>(), homeGameProgression));

            default:
                throw new ApplicationException("Bad series type from Playoff Series rule: " + seriesType);
            }
        }
Beispiel #21
0
        public void ShouldCopyTeamsFromPlayoff()
        {
            var oldPlayoff = new Playoff();

            CreatePlayoffTeams(oldPlayoff);

            var playoffConfig = new PlayoffCompetitionConfig();
            var newPlayoff    = new Playoff()
            {
                Year = 15
            };

            playoffConfig.CopyTeamsFromCompetition(newPlayoff, oldPlayoff);

            StrictEqual(12, newPlayoff.Teams.Count());
        }
        public virtual void ProcessRankingRules(Playoff playoff)
        {
            var activeRankingRules = GetActiveRankingRules(playoff.Year);
            var levels             = activeRankingRules.Select(a => a.GroupSetupLevel).Distinct().ToList();

            levels.Sort();

            levels.ForEach(level =>
            {
                activeRankingRules.Where(arr => arr.GroupSetupLevel == level).ToList().ForEach(rule =>
                {
                    CreateRankingsFromRule(playoff, rule);
                });

                playoff.SeedRankingsGroups();
            });
        }
Beispiel #23
0
 private void CreatePlayoffTeams(Playoff playoff)
 {
     playoff.Teams = new List <CompetitionTeam>()
     {
         new PlayoffTeam(playoff, teams[0], 1),
         new PlayoffTeam(playoff, teams[1], 1),
         new PlayoffTeam(playoff, teams[2], 1),
         new PlayoffTeam(playoff, teams[3], 1),
         new PlayoffTeam(playoff, teams[4], 1),
         new PlayoffTeam(playoff, teams[5], 1),
         new PlayoffTeam(playoff, teams[6], 1),
         new PlayoffTeam(playoff, teams[7], 1),
         new PlayoffTeam(playoff, teams[8], 1),
         new PlayoffTeam(playoff, teams[9], 1),
         new PlayoffTeam(playoff, teams[10], 1),
         new PlayoffTeam(playoff, teams[11], 1)
     };
 }
Beispiel #24
0
        public void ShouldCopyTeamsFromSeason()
        {
            var season = new Season(null, "My Season", 1, null, null, null, null, true, false, 1, null);

            CreateSeasonDivisions(season);
            CreateSeasonTeams(season);
            CreateSeasonRankings(season);

            var playoffConfig = new PlayoffCompetitionConfig();
            var playoff       = new Playoff()
            {
                Year = 15
            };

            playoffConfig.CopyTeamsFromCompetition(playoff, season);

            StrictEqual(12, playoff.Teams.Count());
        }
Beispiel #25
0
        //get the teams from the competition and add them to the group
        public void AddTeamsFromRuleToCompetition(ICompetition oldCompetition, Playoff playoff)
        {
            if (oldCompetition.Name.Equals(FromCompetitionName))
            {
                var oldRankings = oldCompetition.Rankings.Where(r => r.Group.Equals(GroupName) && r.Rank >= FirstRank && r.Rank <= LastRank).ToList();

                var newRankings = new List <PlayoffRanking>();

                oldRankings.ForEach(oldRank =>
                {
                    playoff.AddRanking(oldRank.Team.Name, GroupName, oldRank.Rank);
                });
            }
            else
            {
                throw new PlayoffException("Can't add competition " + oldCompetition.Name + " expecting: " + FromCompetitionName);
            }
        }
        public override Competition CreateCompetitionDetails(int day, int year, IList <Competition> parents)
        {
            var playoff = new Playoff(this, Name, year, 1, null, null, null, null, false, false, day, null);

            ProcessRankingRulesAndAddTeams(playoff, parents);

            ProcessSeriesRules(playoff);

            if (parents != null) //assume shared schedule
            {
                playoff.Schedule = parents[0].Schedule;
            }

            playoff.BeginRound(day);

            playoff.StartDay = day;

            return(playoff);
        }
Beispiel #27
0
        public void ShouldCreateTeamRankingsFromPlayoff()
        {
            var oldPlayoff = new Playoff();

            CreatePlayoffTeams(oldPlayoff);
            CreatePlayoffRankings(oldPlayoff);

            var playoffConfig = new PlayoffCompetitionConfig();
            var newPlayoff    = new Playoff()
            {
                Year = 15
            };

            playoffConfig.CopyTeamsFromCompetition(newPlayoff, oldPlayoff);
            playoffConfig.CopyRankingsFromCompetition(newPlayoff, oldPlayoff);

            StrictEqual(4, newPlayoff.Rankings.Count());
            Single(newPlayoff.Rankings.Where(r => r.GroupName.Equals("NHL") && r.Rank == 6 && r.CompetitionTeam.Name.Equals("Team 6")));
        }
Beispiel #28
0
        public void TestMethod1()
        {
            double[,] newMatrix = { { 7, 5, 5, 1, 6 },
                                    { 2, 3, 4, 2, 5 },
                                    { 6, 3, 2, 4, 4 },
                                    { 3, 5, 5, 7, 7 },
                                    { 7, 2, 4, 3, 2 },
                                    { 5, 4, 7, 5, 3 },
                                    { 4, 3, 4, 3, 4 },
                                    { 3, 4, 4, 5, 5 } };
            Playoff playoff = new Playoff(newMatrix);
            Risk    risk    = Converter.fromPlayoffToRisk(playoff);

            double[] currentState = { 0.2, 0.1, 0.3, 0.3, 0.1 };
            risk.addStateOfNature(currentState);
            risk.findMaxExperimentPrice();

            Assert.AreEqual(1.4, risk.MaxExperiment);
        }
        public void ShouldMapPlayoffSummary()
        {
            var mapper = new PlayoffToPlayoffSummaryMapper();

            var league            = new League("League 1", 1, null);
            var competitionConfig = new PlayoffCompetitionConfig("P Config", league, 1, 1, null, 1, null, null, null, null, null);
            var playoff           = new Playoff(competitionConfig, "Playoff 1", 1, 5, null, null, null, null, true, false, 1, 15);
            var series            = new List <PlayoffSeries>()
            {
                new BestOfSeries(playoff, "Series 1", 1, 1, new PlayoffTeam()
                {
                    Name = "Team 1"
                }, new PlayoffTeam {
                    Name = "Team 2"
                }, 1, 4, 4, new List <PlayoffGame>()
                {
                    new PlayoffGame(), new PlayoffGame()
                }, new int[] { }),
                new BestOfSeries(playoff, "Series 2", 2, 12, new PlayoffTeam()
                {
                    Name = "Team 3"
                }, new PlayoffTeam {
                    Name = "Team 4"
                }, 1, 4, 4, new List <PlayoffGame>()
                {
                    new PlayoffGame(), new PlayoffGame()
                }, new int[] { })
            };

            playoff.Series = series;

            var playoffSummaryModel = mapper.MapDomainToModel(playoff);

            StrictEqual(2, playoffSummaryModel.Series.ToList().Count);
            StrictEqual(5, playoffSummaryModel.CurrentRound);
            StrictEqual(1, playoffSummaryModel.Year);
            Equals(CompetitionViewModel.PLAYOFF_TYPE, playoffSummaryModel.Type);
        }
        public Playoff GetRandomPlayoff()
        {
            var playoff = new Playoff(System.IO.File.ReadAllText("Misc/Playoff.html"));

            return(playoff);
        }