public void WhenGettingAllRecords_ThenRecordsIncludeRegionCode() { var repository = new CountryRepository(); var countries = repository.GetAll().ToList(); Assert.NotNull(countries); Assert.Equal("AF", countries[0].TwoLetterRegionCode); }
public void WhenGettingAllRecords_ThenAllRecordsAreReturned() { var repository = new CountryRepository(); var countries = repository.GetAll(); Assert.NotNull(countries); Assert.Equal(127, countries.Count()); }
public void WhenGettingAllRecords_ThenRecordsIncludeName() { var repository = new CountryRepository(); var countries = repository.GetAll().ToList(); Assert.NotNull(countries); Assert.Equal("Afghanistan", countries[0].Name); }
public void WhenGettingAllRecords_ThenAllRecordsAreReturned() { var repository = new CountryRepository(new MileageStatsDbContext()); var countries = repository.GetAll(); Assert.NotNull(countries); Assert.Equal(238, countries.Count()); }
public void CountriesCRUDTest() { var sessionFactory = SessionFactory.CreateSessionFactory(true); const string country1 = "CountryName1"; const string country2 = "CountryName2"; var countries = new List<Country> { TestEntities.CreateCountry(10000, "EnglishName1", country1), TestEntities.CreateCountry(10001, "EnglishName2", country2) }; var session = SessionManager.CurrentSession; var repository = new CountryRepository(session); repository.SaveUpdateCountries(countries); var fromDb = repository.GetAll(); Assert.True(fromDb.ToList().Count(c => c.CountryName == country1 || c.CountryName == country2) == 2 ); var updateCountry = countries.First(); const string country3 = "CountryName3"; const string englishName3 = "EnglishName3"; updateCountry.EnglishName = englishName3; updateCountry.CountryName = country3; repository.SaveUpdate(updateCountry); var updatedCountry = repository.GetById(updateCountry.CountryId); Assert.True(updatedCountry.CountryName == updateCountry.CountryName); Assert.True(updatedCountry.EnglishName == updateCountry.EnglishName); foreach (var country in countries) { repository.Delete(country); } session.Flush(); fromDb = repository.GetAll(); Assert.True(fromDb.ToList().Count(c => c.CountryName == country1 || c.CountryName == country2) == 0); }
public void CountryRepositoryGetAllReturnMaterializedAllItems() { //Arrange var unitOfWork = new MainBCUnitOfWork(); var countryRepository = new CountryRepository(unitOfWork); //Act var allItems = countryRepository.GetAll(); //Assert Assert.IsNotNull(allItems); Assert.IsTrue(allItems.Any()); }
public override void MigrateWorldDetails() { var repository = new CountryRepository(Session); var wsCountries = repository.GetAll().ToList(); var countryList = ReadWorldDetails(); foreach (var htCountry in countryList) { var country = wsCountries.FirstOrDefault(c => c.HtCountryId == htCountry.LeagueID); if (country == null) { country = new Country { IsNewValue = true }; wsCountries.Add(country); } country.HtCountryId = htCountry.LeagueID; country.CountryName = htCountry.LeagueName; country.EnglishName = htCountry.EnglishName; country.SeasonOffset = htCountry.SeasonOffset; country.NumberOfLevels = htCountry.NumberOfLevels; country.CountryInWhoScored = htCountry.LeagueInWhoScored; country.SeriesMatchTime = DateTime.Parse(htCountry.SeriesMatchDate).TimeOfDay; country.SeriesMatchWeekDay = (short)DateTime.Parse(htCountry.SeriesMatchDate).DayOfWeek; if (htCountry.SeriesIdList != null) country.AddSeriesIdRange(htCountry.SeriesIdList); } repository.SaveUpdateCountries(wsCountries); }
private void LoadBusinessDay(string selectedid) { CountryRepository facade = new CountryRepository(); var src = facade.GetAll().ToList(); Util.LoadData2RadCombo(rcbBusDay, src, "MaQuocGia", "MaQuocGia", "-Select Business Day-", true); if (!String.IsNullOrEmpty(selectedid)) { rcbBusDay.SelectedValue = selectedid; } }
public IEnumerable <CountryDTO> GetAll() { return(_repo.GetAll().Translate <Country, CountryDTO>()); }