public void SeasonGroupSplitGroupCompetitors() { VerifyTournamentGroups(_seasonApiData.groups, _seasonCiData.GetGroupsAsync(_cultures).Result); VerifyTournamentCompetitors(_seasonApiData.competitors, _seasonApiData.groups, _seasonCiData.GetCompetitorsIdsAsync(_cultures).Result); var oldGroup = _seasonApiData.groups[0]; var oldGroupCompetitors = _seasonApiData.groups[0].competitor.ToList(); var newGroupCompetitors = new List <team>(); var i = _seasonApiData.groups[0].competitor.Length / 2; while (i > 0) { newGroupCompetitors.Add(_seasonApiData.groups[0].competitor[i]); oldGroupCompetitors.RemoveAt(i); i--; } var newGroup = new tournamentGroup { id = "2", name = "Name2", competitor = newGroupCompetitors.ToArray() }; oldGroup.competitor = oldGroupCompetitors.ToArray(); _seasonApiData.groups = new[] { oldGroup, newGroup }; _seasonDtoData = new TournamentInfoDTO(_seasonApiData); _seasonCiData.Merge(_seasonDtoData, TestData.Culture, false); VerifyTournamentGroups(_seasonApiData.groups, _seasonCiData.GetGroupsAsync(_cultures).Result); VerifyTournamentCompetitors(_seasonApiData.competitors, _seasonApiData.groups, _seasonCiData.GetCompetitorsIdsAsync(_cultures).Result); }
public void MergeTournamentGroupBase() { Assert.IsNotNull(_tourCiData); Assert.IsNotNull(_tourApiData); _tourDtoData = new TournamentInfoDTO(_tourApiData); _tourCiData.Merge(_tourDtoData, TestData.Culture, false); Assert.AreEqual(URN.Parse(_tourApiData.tournament.id), _tourCiData.Id); Assert.IsNotNull(_tourApiData.groups); var groups = _tourCiData.GetGroupsAsync(_cultures).Result.ToList(); Assert.IsNotNull(groups); VerifyTournamentGroups(_tourApiData.groups, _tourCiData.GetGroupsAsync(_cultures).Result); Assert.AreEqual(1, _tourApiData.groups.Length); Assert.AreEqual(_tourApiData.groups.Length, groups.Count); var groupCompetitorIds = groups[0].CompetitorsIds.ToList(); var sapiTeams = _tourApiData.groups[0].competitor.ToList(); Assert.AreEqual(sapiTeams.Count, groups[0].CompetitorsIds.Count()); foreach (var sapiTeam in sapiTeams) { Assert.IsTrue(groupCompetitorIds.Contains(URN.Parse(sapiTeam.id))); } VerifyTournamentCompetitors(_tourApiData.competitors, _tourApiData.groups, _tourCiData.GetCompetitorsIdsAsync(_cultures).Result); }