Exemplo n.º 1
0
        public void MigrateFixturesTest()
        {
            const int seriesId = 29747;
            const int htCountryId = 66;
            var country = TestEntities.CreateCountry(htCountryId, "EnglishName", "countryName");
            var series = TestEntities.CreateSeries(seriesId, country, "A Lyga");
            var suportedSeriesIds = TestEntities.CreateSupportedIdList();
            country.AddSeriesIdRange(suportedSeriesIds);
            var sessionFactory = SessionFactory.CreateSessionFactory(true);
            using (var session = sessionFactory.OpenSession())
            {
                session.SaveOrUpdate(country);
                session.SaveOrUpdate(series);
                session.Flush();
            }

            var service = new MigrateToNhibernateDomainService(SessionManager.CurrentSession);
            service.MigrateFixtures(seriesId, 30);
            service.MigrateFixtures(seriesId, 29);

            using (var session = sessionFactory.OpenSession())
            {
                var fixtures = session.CreateCriteria<SeriesFixture>()
                    .Add(Restrictions.Eq("Series.Id", series.Id))
                    .Add(Restrictions.Eq("Season", (Int16)30))
                    .List<SeriesFixture>();
                Assert.True(fixtures.Count == 56);
            }
        }
Exemplo n.º 2
0
        public ActionResult MigrateSeriesFixtures(int seriesId, int season)
        {
            var migrationService = new MigrateToNhibernateDomainService(_session);
            migrationService.MigrateFixtures(seriesId, season);

            return Json(true);
        }