public void CountryArrayTest() { const int contryId = 10000; var country = TestEntities.CreateCountry(contryId, "EnglishName1", "CountryName1"); var seriesIdList = new List<int> {1, 2, 3, 4, 5, 6}; country.AddSeriesIdRange(seriesIdList); int listCount = seriesIdList.Count; var sessionFactory = SessionFactory.CreateSessionFactory(true); using (var session = sessionFactory.OpenSession()) { session.SaveOrUpdate(country); session.Flush(); } var repository = new CountryRepository(SessionManager.CurrentSession); var fromDb = repository.GetCountryByHtId(contryId); Assert.True(fromDb.SupportedSeriesId.Count == listCount); }
public override void MigrateLeagueDetails(int countryId) { var countryRepository = new CountryRepository(Session); var country = countryRepository.GetCountryByHtId(countryId); foreach (var series in country.SupportedSeriesId) { if (country.Series.FirstOrDefault(s => s.HtSeriesId == series.HtSeriesId) == null) { var htseries = ReadSeriesDetails(series.HtSeriesId); country.AddSeries(new Series { HtSeriesId = htseries.LeagueLevelUnitID, LeagueLevel = (short)htseries.LeagueLevel, LeagueLevelUnitName = htseries.LeagueLevelUnitName }); } } countryRepository.SaveUpdate(country); Session.Flush(); }