Example #1
0
        public async Task AnalyzeAsyncTest()
        {
            using (EtymologyContext database = CreateDatabase())
            {
                const string   chinese        = "车";
                CharacterCache characterCache = new CharacterCache();
                await characterCache.Initialize(database);

                IEnumerable <(string Traditional, int CodePoint)> allTraditional = characterCache.AllTraditional(char.ConvertToUtf32(chinese, 0));
                AnalyzeResult[] results = await database.AnalyzeAsync(chinese, allTraditional);

                Assert.AreEqual(1, results.Length);
                var(queriedChinese, etymology, oracles, bronzes, seals, liushutongs) = results.Single();
                Assert.AreEqual(chinese, queriedChinese);
                Assert.IsNotNull(etymology);
                Assert.IsNotNull(etymology);
                Assert.IsNotNull(oracles);
                Assert.IsTrue(oracles.Any());
                Assert.IsNotNull(oracles.First());
                Assert.IsNotNull(bronzes);
                Assert.IsTrue(bronzes.Any());
                Assert.IsNotNull(bronzes.First());
                Assert.IsNotNull(seals);
                Assert.IsTrue(seals.Any());
                Assert.IsNotNull(seals.First());
                Assert.IsNotNull(liushutongs);
                Assert.IsTrue(liushutongs.Any());
                Assert.IsNotNull(liushutongs.First());
                Trace.WriteLine($"{chinese} {oracles.Length} {bronzes.Length} {seals.Length} {liushutongs.Length}");
            }
        }
        public async Task AnalyzeAsyncTest()
        {
            using (EtymologyContext database = CreateDatabase())
            {
                AnalyzeResult[] results = await database.AnalyzeAsync("车");

                Assert.AreEqual(1, results.Length);
                var(chinese, etymology, oracles, bronzes, seals, liushutongs) = results.Single();
                Assert.IsNotNull(etymology);
                Assert.IsNotNull(etymology);
                Assert.IsNotNull(oracles);
                Assert.IsTrue(oracles.Any());
                Assert.IsNotNull(oracles.First());
                Assert.IsNotNull(bronzes);
                Assert.IsTrue(bronzes.Any());
                Assert.IsNotNull(bronzes.First());
                Assert.IsNotNull(seals);
                Assert.IsTrue(seals.Any());
                Assert.IsNotNull(seals.First());
                Assert.IsNotNull(liushutongs);
                Assert.IsTrue(liushutongs.Any());
                Assert.IsNotNull(liushutongs.First());
                Trace.WriteLine($"{chinese} {oracles.Length} {bronzes.Length} {seals.Length} {liushutongs.Length}");
            }
        }
Example #3
0
        public async Task ExtensionBTest()
        {
            using (EtymologyContext database = CreateDatabase())
            {
                const string   extensionB     = "𠂇";
                CharacterCache characterCache = new CharacterCache();
                await characterCache.Initialize(database);

                IEnumerable <(string Traditional, int CodePoint)> allTraditional = characterCache.AllTraditional(char.ConvertToUtf32(extensionB, 0));
                var(chinese, etymology, oracles, bronzes, seals, liushutongs) = (await database.AnalyzeAsync(extensionB, allTraditional)).Single();
                Assert.IsNotNull(etymology);
                Assert.IsNotNull(etymology);
                Assert.AreEqual(extensionB, etymology.Traditional);
                Trace.WriteLine($"{chinese} {oracles.Length} {bronzes.Length} {seals.Length} {liushutongs.Length}");
            }
        }
 public async Task ExtensionBTest()
 {
     using (EtymologyContext database = CreateDatabase())
     {
         const string extensionB = "𠂇";
         var(chinese, etymology, oracles, bronzes, seals, liushutongs) = (await database.AnalyzeAsync(extensionB)).Single();
         Assert.IsNotNull(etymology);
         Assert.IsNotNull(etymology);
         Assert.AreEqual(extensionB, etymology.Traditional);
         Trace.WriteLine($"{chinese} {oracles.Length} {bronzes.Length} {seals.Length} {liushutongs.Length}");
     }
 }