Beispiel #1
0
        public void ISOLanguageCodeComposer_ComposesFileCorrectly()
        {
            var src = @"testdata\test_iso-languagecodes.txt";
            var dst = @"testdata\test_iso-languagecodes.out.txt";

            GeoFileWriter.WriteISOLanguageCodes(dst, GeoFileReader.ReadISOLanguageCodes(src));

            FileUtil.EnsureFilesAreFunctionallyEqual(src, dst, 4, 1, new[] { '\t' }, Encoding.UTF8, false);
        }
Beispiel #2
0
        public void IsoLanguageCodeParser_ParsesFileCorrectly()
        {
            var target = GeoFileReader.ReadISOLanguageCodes(@"testdata\test_iso-languagecodes.txt").ToArray();

            Assert.AreEqual(2, target.Length);  //First line in file should've been skipped


            Assert.AreEqual("alw", target[0].ISO_639_3);
            Assert.AreEqual(string.Empty, target[0].ISO_639_2);
            Assert.AreEqual(string.Empty, target[0].ISO_639_1);
            Assert.AreEqual("Alaba-K’abeena", target[0].LanguageName);

            Assert.AreEqual("zul", target[1].ISO_639_3);
            Assert.AreEqual("zul", target[1].ISO_639_2);
            Assert.AreEqual("zu", target[1].ISO_639_1);
            Assert.AreEqual("Zulu", target[1].LanguageName);
        }
Beispiel #3
0
 public void FileReader_ISOLanguageCode_StreamOverload()
 {
     using (var s = File.OpenRead(@"testdata\test_iso-languagecodes.txt"))
         GeoFileReader.ReadISOLanguageCodes(s).Count();
 }
Beispiel #4
0
 private static GeoFile[] GetDumps(GeoFileDownloader downloader)
 {
     return(new[] {
         new GeoFile {
             Filename = "admin1CodesASCII.txt", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadAdmin1Codes(fn).Count(); })
         },
         new GeoFile {
             Filename = "admin2Codes.txt", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadAdmin2Codes(fn).Count(); })
         },
         new GeoFile {
             Filename = "allCountries.zip", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadExtendedGeoNames(fn).Count(); })
         },
         new GeoFile {
             Filename = "alternateNames.zip", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadAlternateNames(fn).Count(); })
         },
         new GeoFile {
             Filename = "cities1000.zip", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadExtendedGeoNames(fn).Count(); })
         },
         new GeoFile {
             Filename = "cities15000.zip", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadExtendedGeoNames(fn).Count(); })
         },
         new GeoFile {
             Filename = "cities5000.zip", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadExtendedGeoNames(fn).Count(); })
         },
         new GeoFile {
             Filename = "countryInfo.txt", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadCountryInfo(fn).Count(); })
         },
         //Featurecodes are downloaded by GetCountryDumps()
         new GeoFile {
             Filename = "hierarchy.zip", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadHierarchy(fn).Count(); })
         },
         new GeoFile {
             Filename = "iso-languagecodes.txt", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadISOLanguageCodes(fn).Count(); })
         },
         new GeoFile {
             Filename = "no-country.zip", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadExtendedGeoNames(fn).Count(); })
         },
         new GeoFile {
             Filename = "timeZones.txt", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadTimeZones(fn).Count(); })
         },
         new GeoFile {
             Filename = "userTags.zip", Test = (f) => ExecuteTest(f, (fn) => { return GeoFileReader.ReadUserTags(fn).Count(); })
         },
     }.Union(GetCountryDumps(downloader)).ToArray());
 }