예제 #1
0
        private Encounter GetExistentMatch(int anId)
        {
            EncounterEntity entity = context.Encounters
                                     .Include(m => m.SportEntity)
                                     .Include(m => m.Commentaries).ThenInclude(c => c.Maker)
                                     .First(me => me.Id == anId);

            ICollection <EncounterTeam> match_teams = context.EncounterTeams.Include(mt => mt.Team)
                                                      .ThenInclude(t => t.Sport)
                                                      .Where(mt => mt.EncounterId == anId)
                                                      .ToList();
            Encounter conversion = matchConverter.ToEncounter(entity, match_teams);

            context.Entry(entity).State = EntityState.Detached;
            foreach (EncounterTeam mt in match_teams)
            {
                context.Entry(mt).State = EntityState.Detached;
            }
            return(conversion);
        }
        public void EntityToMatchTeamsTest()
        {
            Encounter conversion = testMapper.ToEncounter(entity, playingTeams);

            Assert.AreEqual(match.GetParticipants().Count, playingTeams.Count);
        }