public void SetUp() { factory = new EncounterFactory(); testMapper = new EncounterMapper(); SportEntity testSport = new SportEntity() { Name = "Soccer", IsTwoTeams = true }; TeamEntity homeTest = new TeamEntity { TeamNumber = 3, SportEntityName = "Soccer", Sport = testSport, Name = "Nacional", Photo = "aPath" }; TeamEntity awayTest = new TeamEntity { TeamNumber = 4, SportEntityName = "Soccer", Sport = testSport, Name = "Torque", Photo = "aPath" }; entity = new EncounterEntity() { Id = 3, Date = DateTime.Now, SportEntity = testSport, HasResult = false, Commentaries = new List <CommentEntity>() }; EncounterTeam homeRel = new EncounterTeam() { Team = homeTest, TeamNumber = 3, Encounter = entity, EncounterId = 3 }; EncounterTeam awayRel = new EncounterTeam() { Team = awayTest, TeamNumber = 4, Encounter = entity, EncounterId = 3 }; playingTeams = new List <EncounterTeam>() { homeRel, awayRel }; homeMock = new Team(3, "Nacional", "aPath", new Sport("Soccer", true)); awayMock = new Team(4, "Torque", "aPath", new Sport("Soccer", true)); Sport sport = new Sport("Soccer", true); match = factory.CreateEncounter(new List <Team>() { homeMock, awayMock }, DateTime.Now, sport); }
public ICollection <EncounterTeam> ConvertParticipants(Encounter anEncounter) { EncounterEntity matchEntity = ToEntity(anEncounter); ICollection <EncounterTeam> conversions = new List <EncounterTeam>(); foreach (Team participant in anEncounter.GetParticipants()) { TeamEntity team = teamConverter.ToEntity(participant); EncounterTeam participantConversion = new EncounterTeam() { Encounter = matchEntity, EncounterId = matchEntity.Id, Team = team, TeamNumber = team.TeamNumber }; conversions.Add(participantConversion); } if (anEncounter.HasResult()) { ResultsToEntity(conversions, anEncounter.Result); } return(conversions); }