示例#1
0
        public void ReplaceAllWord()
        {
            Spelling _SpellChecker = NewSpellChecker();

            _SpellChecker.Text = "this is a tst of a tst errr";
            _SpellChecker.IgnoreList.Clear();
            _SpellChecker.ReplaceList.Clear();

            _SpellChecker.SpellCheck();
            Assertion.AssertEquals("Incorrect WordOffset", 3, _SpellChecker.WordIndex);
            Assertion.AssertEquals("Incorrect CurrentWord", "tst", _SpellChecker.CurrentWord);
            _SpellChecker.ReplaceAllWord("test");
            Assertion.AssertEquals("Incorrect Text", "this is a test of a tst errr", _SpellChecker.Text);

            _SpellChecker.SpellCheck();
            Assertion.AssertEquals("Incorrect WordOffset", 7, _SpellChecker.WordIndex);
            Assertion.AssertEquals("Incorrect CurrentWord", "errr", _SpellChecker.CurrentWord);
            Assertion.AssertEquals("Incorrect Text", "this is a test of a test errr", _SpellChecker.Text);
        }
示例#2
0
        public void ReplaceAllWord()
        {
            Spelling _SpellChecker = NewSpellChecker();

            _SpellChecker.Text = "this is a tst of a tst errr";
            _SpellChecker.IgnoreList.Clear();
            _SpellChecker.ReplaceList.Clear();

            _SpellChecker.SpellCheck();
            Assert.True(3 == _SpellChecker.WordIndex, "Incorrect WordOffset");
            Assert.True("tst" == _SpellChecker.CurrentWord, "Incorrect CurrentWord");
            _SpellChecker.ReplaceAllWord("test");
            Assert.True("this is a test of a tst errr" == _SpellChecker.Text, "Incorrect Text");

            _SpellChecker.SpellCheck();
            Assert.True(7 == _SpellChecker.WordIndex, "Incorrect WordOffset");
            Assert.True("errr" == _SpellChecker.CurrentWord, "Incorrect CurrentWord");
            Assert.True("this is a test of a test errr" == _SpellChecker.Text, "Incorrect Text");
        }
 protected void ReplaceAllButton_Click(object sender, EventArgs e)
 {
     SpellChecker.ReplaceAllWord(ReplacementWord.Text);
     CurrentText.Value = SpellChecker.Text;
     SpellChecker.SpellCheck();
 }