ResetDictionary() public static method

Reset the whole dictionary for this ID. Henceforth it will contain exactly the words passed. Note that this will not affect any existing ISpellEngine; try not to have any left around.
public static ResetDictionary ( string id, IEnumerable words ) : void
id string
words IEnumerable
return void
コード例 #1
0
        public void ResetDictionary_AddsNoWordsToNonPrivate()
        {
            MakeNonPrivateBlahDictionary();
            SpellingHelper.ResetDictionary("blah", new[] { "hello", "world" });
            var filePath = SpellingHelper.GetDicPath(SpellingHelper.GetSpellingDirectoryPath(), "blah");
            var contents = File.ReadAllText(filePath);

            Assert.That(contents, Is.Not.StringContaining(SpellingHelper.PrototypeWord));
            Assert.That(contents, Is.Not.StringContaining("hello"));
            Assert.That(contents, Is.Not.StringContaining("world"));
            Assert.That(contents, Contains.Substring("blah"));
        }
コード例 #2
0
        public void ResetDictionaryAddsAllWords()
        {
            var id   = MakeEmptyFooDictionary();
            var dict = SpellingHelper.GetSpellChecker(id);

            dict.SetStatus("old", true);
            Assert.That(dict.Check("old"), Is.True);

            SpellingHelper.ResetDictionary(id, new[] { "hello", "wo\x0302rld", "this", "is", "a", "test" });
            dict = SpellingHelper.GetSpellChecker(id);

            Assert.That(dict.Check("old"), Is.False);
            Assert.That(dict.Check("hello"), Is.True);
            Assert.That(dict.Check("w\x00f4rld"), Is.True);
            Assert.That(dict.Check("wo\x0302rld"), Is.True);             // decomposed form.
            Assert.That(dict.Check("is"), Is.True);
            Assert.That(dict.Check("a"), Is.True);
            Assert.That(dict.Check("test"), Is.True);
        }