[Test] public void TestParseContent() { Assert.Throws <FormatException>(() => WordDownloader.ParseContent(string.Empty)); Assert.Throws <FormatException>(() => WordDownloader.ParseContent("<span class='mot'>")); Assert.Throws <FormatException>(() => WordDownloader.ParseContent("<span class='mot'></span>")); var wc = WordDownloader.ParseContent("Il y a 2 mots <span class='mot'>UN DEUX</span>"); Assert.AreEqual(2, wc.Count); Assert.AreEqual(2, wc.Words.Count); Assert.IsTrue(wc.Words.Contains("UN")); Assert.IsTrue(wc.Words.Contains("DEUX")); Assert.IsTrue(wc.IsFull); }
[Test] public void TestParseContentCN() { const string ResourcePath = "Ded.Wordox.Resources."; var resources = new AssemblyResources(typeof(WordDownloaderTest), ResourcePath); string content = resources.GetContent("mots9lettresdebutantcn.htm"); WordContent wc = WordDownloader.ParseContent(content); Assert.AreEqual(1, wc.Count); Assert.AreEqual(1, wc.Words.Count); Assert.IsTrue(wc.IsFull); foreach (string w in wc.Words) { Assert.AreEqual(9, w.Length); } }
[Test] public void TestParseContent6() { const string ResourcePath = "Ded.Wordox.Resources."; var resources = new AssemblyResources(typeof(WordDownloaderTest), ResourcePath); string content = resources.GetContent("mots6lettres.htm"); WordContent wc = WordDownloader.ParseContent(content); Assert.AreEqual(17318, wc.Count); Assert.AreEqual(17318 - 10175, wc.Words.Count); Assert.IsFalse(wc.IsFull); foreach (string w in wc.Words) { Assert.AreEqual(6, w.Length); } }