Esempio n. 1
0
        public void SeriesSaveTest()
        {
            var country = TestEntities.CreateCountry(66, "EnglishName", "CountryName");
            var sessionFactory = SessionFactory.CreateSessionFactory(true);
            using (var session = sessionFactory.OpenSession())
            {
                session.SaveOrUpdate(country);
                session.Flush();
            }

            List<Series> series = TestEntities.CreateSeries(1000, country);
            var prodSession = SessionManager.CurrentSession;
            var repository = new SeriesRepository(prodSession);
            repository.SaveUpdateSeries(series);

            var countrySeries = repository.GetAllSeriesForCountry(66);
            Assert.True(countrySeries.Count() == 2);
            Assert.True(countrySeries.First().SeriesFixtures.Count == 1);
            Assert.True(countrySeries.First().SeriesFixtures.First().HomeTeam.TeamName == "TeamName1");
            Assert.True(countrySeries.First().SeriesFixtures.First().AwayTeam.TeamName == "TeamName2");
        }
Esempio n. 2
0
        public void SeriesUpdateTest()
        {
            var country = TestEntities.CreateCountry(66, "EnglishName", "CountryName");
            List<Series> series = TestEntities.CreateSeries(1000, country);
            var sessionFactory = SessionFactory.CreateSessionFactory(true);
            using (var session = sessionFactory.OpenSession())
            {
                using (session.BeginTransaction())
                {
                    session.SaveOrUpdate(country);
                    foreach (var league in series)
                    {
                        session.SaveOrUpdate(league);
                    }
                    session.Transaction.Commit();
                }
            }

            var repository = new SeriesRepository(SessionManager.CurrentSession);
            var countrySeries = repository.GetAllSeriesForCountry(66).ToList();

            const string newValue = "newName";
            countrySeries.First(s => s.HtSeriesId == 1000).LeagueLevelUnitName = newValue;
            repository.SaveUpdateSeries(countrySeries);

            var newSeries = repository.GetAllSeriesForCountry(66);
            Assert.True(newSeries.First(s => s.HtSeriesId == 1000).LeagueLevelUnitName == newValue);
        }
Esempio n. 3
0
        public void SeriesLoadTest()
        {
            var country = TestEntities.CreateCountry(66, "EnglishName", "CountryName");

            List<Series> series = TestEntities.CreateSeries(1000, country);
            var sessionFactory = SessionFactory.CreateSessionFactory(true);
            using (var session = sessionFactory.OpenSession())
            {
                using (session.BeginTransaction())
                {
                    session.SaveOrUpdate(country);
                    foreach (var league in series)
                    {
                        session.SaveOrUpdate(league);
                    }
                    session.Transaction.Commit();
                }
            }

            var repository = new SeriesRepository(SessionManager.CurrentSession);
            var countrySeries = repository.GetAllSeriesForCountry(66);

            Assert.True(countrySeries.Count() == 2);
            Assert.True(countrySeries.First().SeriesFixtures.Count == 1);
            Assert.True(countrySeries.First().SeriesFixtures.First().HomeTeam.TeamName == "TeamName1");
            Assert.True(countrySeries.First().SeriesFixtures.First().AwayTeam.TeamName == "TeamName2");
        }