public void DeleteWord() { Spelling _SpellChecker = NewSpellChecker(); _SpellChecker.Text = "this is is a tst."; _SpellChecker.SpellCheck(); Assert.AreEqual(2, _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.AreEqual("is", _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // basic delete test _SpellChecker.DeleteWord(); Assert.AreEqual("this is a tst.", _SpellChecker.Text, "Incorrect Text"); _SpellChecker.SpellCheck(); Assert.AreEqual(3, _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.AreEqual("tst", _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // before punctuation delete test _SpellChecker.DeleteWord(); Assert.AreEqual("this is a.", _SpellChecker.Text, "Incorrect Text"); _SpellChecker.Text = "Becuase people are realy bad spelers"; _SpellChecker.SpellCheck(); Assert.AreEqual(0, _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.AreEqual("Becuase", _SpellChecker.CurrentWord, "Incorrect CurrentWord"); //delete first word test _SpellChecker.DeleteWord(); Assert.AreEqual("people are realy bad spelers", _SpellChecker.Text, "Incorrect Text"); _SpellChecker.SpellCheck(); Assert.AreEqual(2, _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.AreEqual("realy", _SpellChecker.CurrentWord, "Incorrect CurrentWord"); //delete first word test _SpellChecker.DeleteWord(); Assert.AreEqual("people are bad spelers", _SpellChecker.Text, "Incorrect Text"); _SpellChecker.SpellCheck(); Assert.AreEqual(3, _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.AreEqual("spelers", _SpellChecker.CurrentWord, "Incorrect CurrentWord"); //delete last word test _SpellChecker.DeleteWord(); Assert.AreEqual("people are bad", _SpellChecker.Text, "Incorrect Text"); }
public void DeleteWord() { Spelling _SpellChecker = NewSpellChecker(); _SpellChecker.Text = "this is is a tst."; _SpellChecker.SpellCheck(); Assert.True(2 == _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.True("is" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // basic delete test _SpellChecker.DeleteWord(); Assert.True("this is a tst." == _SpellChecker.Text, "Incorrect Text"); _SpellChecker.SpellCheck(); Assert.True(3 == _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.True("tst" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // before punctuation delete test _SpellChecker.DeleteWord(); Assert.True("this is a." == _SpellChecker.Text, "Incorrect Text"); _SpellChecker.Text = "Becuase people are realy bad spelers"; _SpellChecker.SpellCheck(); Assert.True(0 == _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.True("Becuase" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); //delete first word test _SpellChecker.DeleteWord(); Assert.True("people are realy bad spelers" == _SpellChecker.Text, "Incorrect Text"); //_SpellChecker.SpellCheck(); //Assert.True(2 == _SpellChecker.WordIndex, "Incorrect WordOffset"); //Assert.True("realy" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); ////delete first word test //_SpellChecker.DeleteWord(); //Assert.True("people are bad spelers" == _SpellChecker.Text, "Incorrect Text"); //_SpellChecker.SpellCheck(); //Assert.True(3 == _SpellChecker.WordIndex, "Incorrect WordOffset"); //Assert.True("spelers" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); ////delete last word test //_SpellChecker.DeleteWord(); //Assert.True("people are bad" == _SpellChecker.Text, "Incorrect Text"); }
public void NoText() { Spelling _SpellChecker = NewSpellChecker(); Assert.AreEqual(string.Empty, _SpellChecker.CurrentWord, "Incorrect Current Word"); _SpellChecker.WordIndex = 1; Assert.AreEqual(0, _SpellChecker.WordIndex, "Incorrect Word Index"); Assert.AreEqual(0, _SpellChecker.WordCount, "Incorrect Word Count"); Assert.AreEqual(0, _SpellChecker.TextIndex, "Incorrect Text Index"); _SpellChecker.DeleteWord(); Assert.AreEqual(string.Empty, _SpellChecker.Text, "Incorrect Text"); _SpellChecker.IgnoreWord(); Assert.AreEqual(string.Empty, _SpellChecker.Text, "Incorrect Text"); _SpellChecker.ReplaceWord("Test"); Assert.AreEqual(string.Empty, _SpellChecker.Text, "Incorrect Text"); Assert.IsFalse(_SpellChecker.SpellCheck(), "Spell Check not false"); _SpellChecker.Suggest(); Assert.AreEqual(0, _SpellChecker.Suggestions.Count, "Generated Suggestions with no text"); }
private void RemoveWordClick(object sender, EventArgs e) { _spelling.DeleteWord(); CheckSpelling(); }
public void TestEvents() { Spelling _SpellChecker = NewSpellChecker(); _SpellChecker.Text = "ths is is a tst."; ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.AreEqual(0, _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.AreEqual("ths", _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.AreEqual(EventNames.MisspelledWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastSpellingEvent, "Event not fired"); Assert.AreEqual(0, _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(0, _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("ths", _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.ReplaceWord("this"); //spelling check Assert.AreEqual("this is is a tst.", _SpellChecker.Text, "Incorrect Text"); // event check Assert.AreEqual(EventNames.ReplacedWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastReplaceEvent, "Null Event object fired"); Assert.AreEqual(0, _lastReplaceEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(0, _lastReplaceEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("ths", _lastReplaceEvent.Word, "Incorrect Event Word"); Assert.AreEqual("this", _lastReplaceEvent.ReplacementWord, "Incorrect Event Replacement Word"); ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.AreEqual(2, _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.AreEqual("is", _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.AreEqual(EventNames.DoubledWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastSpellingEvent, "Null Event object fired"); Assert.AreEqual(2, _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(8, _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("is", _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.DeleteWord(); //spelling check Assert.AreEqual("this is a tst.", _SpellChecker.Text, "Incorrect Text"); // event check Assert.AreEqual(EventNames.DeletedWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastSpellingEvent, "Null Event object fired"); Assert.AreEqual(2, _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(8, _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("is ", _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.AreEqual(3, _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.AreEqual("tst", _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.AreEqual(EventNames.MisspelledWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastSpellingEvent, "Null Event object fired"); Assert.AreEqual(3, _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(10, _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("tst", _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.IgnoreWord(); //spelling check Assert.AreEqual("this is a tst.", _SpellChecker.Text, "Incorrect Text"); // event check Assert.AreEqual(EventNames.IgnoredWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastSpellingEvent, "Null Event object fired"); Assert.AreEqual(3, _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(10, _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("tst", _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.SpellCheck(); // event check Assert.AreEqual(EventNames.EndOfText, _lastEvent, "Incorrect Event"); }
public void TestEvents() { Spelling _SpellChecker = NewSpellChecker(); _SpellChecker.Text = "ths is is a tst."; ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.True(0 == _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.True("ths" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.True(EventNames.MisspelledWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastSpellingEvent); //, "Event not fired"); Assert.True(0 == _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(0 == _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("ths" == _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.ReplaceWord("this"); //spelling check Assert.True("this is is a tst." == _SpellChecker.Text, "Incorrect Text"); // event check Assert.True(EventNames.ReplacedWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastReplaceEvent); //, "Null Event object fired"); Assert.True(0 == _lastReplaceEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(0 == _lastReplaceEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("ths" == _lastReplaceEvent.Word, "Incorrect Event Word"); Assert.True("this" == _lastReplaceEvent.ReplacementWord, "Incorrect Event Replacement Word"); ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.True(2 == _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.True("is" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.True(EventNames.DoubledWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastSpellingEvent); //, "Null Event object fired"); Assert.True(2 == _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(8 == _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("is" == _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.DeleteWord(); //spelling check Assert.True("this is a tst." == _SpellChecker.Text, "Incorrect Text"); // event check Assert.True(EventNames.DeletedWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastSpellingEvent); //, "Null Event object fired"); Assert.True(2 == _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(8 == _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("is " == _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.True(3 == _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.True("tst" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.True(EventNames.MisspelledWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastSpellingEvent); //, "Null Event object fired"); Assert.True(3 == _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(10 == _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("tst" == _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.IgnoreWord(); //spelling check Assert.True("this is a tst." == _SpellChecker.Text, "Incorrect Text"); // event check Assert.True(EventNames.IgnoredWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastSpellingEvent); //, "Null Event object fired"); Assert.True(3 == _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(10 == _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("tst" == _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.SpellCheck(); // event check Assert.True(EventNames.EndOfText == _lastEvent, "Incorrect Event"); }