private CachedSpellCheckData JustCheckCore(string word) { _cacheLock.EnterUpgradeableReadLock(); try { CachedSpellCheckData result; if (_cache.TryGetValue(word, out result)) { return(result); } _cacheLock.EnterWriteLock(); try { while (_cache.Count >= _cacheMax) { _cache.Remove(_cache.Keys.First()); } _cache[word] = result = new CachedSpellCheckData(_core.Check(word)); } finally { _cacheLock.ExitWriteLock(); } return(result); } finally { _cacheLock.ExitUpgradeableReadLock(); } }
public void Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { string word = "Believe"; Assert.IsTrue(spellChecker.Check(word)); //throw new NotImplementedException(); }
public void Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { var word = "grievance"; var result = SpellChecker.Check(word); Assert.IsTrue(result, $"{word} is spelled correctly"); }
public void Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { /// Examples: believe, fierce, collie, die, friend, deceive, ceiling, receipt would be evaulated as spelled correctly /// heir, protein, science, seeing, their, and veil would be evaluated as spelled incorrectly. // implement this test SpellChecker.Check("Fierce"); }
public void Check_That_FileAndServe_Is_Misspelled() { var word = "FileAndServe"; var checkTask = spellChecker.Check(word); Assert.IsFalse(checkTask.Result); }
public void Check_That_SharpEcho_Is_Misspelled() { // implement this test string teststr = "SharpEcho"; SpellChecker.Check(teststr); }
public void Check_That_SharpEcho_Is_Misspelled() { var word = "SharpEcho"; var result = SpellChecker.Check(word); Assert.IsFalse(result, $"{word} is spelled incorrectly"); }
public void Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { var word = "ceiling"; var checkTask = spellChecker.Check(word); Assert.IsTrue(checkTask.Result); }
public async Task Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { string word = "believe"; Assert.AreEqual(true, await spellChecker.Check(word)); // throw new NotImplementedException(); }
public async Task <IActionResult> GetWordsWithErrors(string page) { var text = await ApplyRule(page); var errors = await _spellChecker.Check(text); return(Ok(errors.Select(e => e.Word))); }
public async Task Check_That_FileAndServe_Is_Misspelled() { string word = "FileAndServe"; var result = await spellChecker.Check(word); Assert.IsFalse(result); }
public async Task Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { string word = "Diet"; var result = await spellChecker.Check(word); Assert.IsTrue(result); }
public async Task Check_That_FileAndServe_Is_Misspelled() { string word = "FileAndServe"; bool bStatus = await spellChecker.Check(word); Assert.AreEqual(false, bStatus); //throw new NotImplementedException(); }
public async Task Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { //Arrange const string word = "hair"; //Act var result = await spellChecker.Check(word); //Assert Assert.IsTrue(result); }
public void Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { // implement this test // Act var result = SpellChecker.Check("pie"); // Assert Assert.IsTrue(result); }
public void Check_That_FileAndServe_Is_Misspelled() { // Arrange string testString = "FileAndServe"; // Act bool spelledRight = spellChecker.Check(testString); // Assert Assert.IsFalse(spelledRight); }
public async Task Check_That_FileAndServe_Is_Misspelled() { //Arrange const string word = "worwd"; //Act var result = await spellChecker.Check(word); //Assert Assert.IsFalse(result); }
public void Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { var spelledCorrectly = new List <string>() { "believe", "fierce", "collie", "die", "friend", "deceive", "ceiling", "receipt" }; foreach (var word in spelledCorrectly) { Assert.IsTrue(spellChecker.Check(word)); } }
public void Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { // implement this test // Arrange bool result; bool expectedResult = true; // Act result = SpellChecker.Check("receive"); // Assert Assert.AreEqual(expectedResult, result, "Spell check did not execute correctly"); }
public async Task Check_That_FileAndServe_Is_Misspelled() { _mockHttpClient .Setup(m => m.GetAsync(It.IsAny <string>())) .Returns(Task.FromResult(new HttpResponseMessage { StatusCode = HttpStatusCode.NotFound, })); var isSpelledCorrectly = await _spellChecker.Check("FileAndServe"); Assert.IsFalse(isSpelledCorrectly); }
public void Check_That_Method_Queries_DictionaryDotCom() { var expectedUri = new Uri("http://dictionary.com/browse/Anything"); SpellChecker.Check("Anything"); FoundHandler.Protected().Verify( "SendAsync", Times.Exactly(1), // we expected a single external request ItExpr.Is <HttpRequestMessage>(req => req.Method == HttpMethod.Get && // we expected a GET request req.RequestUri == expectedUri // to this uri ), ItExpr.IsAny <CancellationToken>() ); }
public void Check_That_SharpEcho_Is_Misspelled() { // implement this test // Arrange string input = "SharpEcho"; bool result; bool expectedResult = false; // Act result = SpellChecker.Check(input); // Assert Assert.AreEqual(expectedResult, result, "Spell check did not execute correctly"); }
public void SpellCheker_Check() { //Arrange //Act _spellChecker.Check(); //Assert foreach (var outputLine in _testWriter.Output) { _outputText.ShouldContain(outputLine); } }
public void Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { Assert.IsTrue(spellChecker.Check("receipt").Result); Assert.IsTrue(spellChecker.Check("priest").Result); Assert.IsTrue(spellChecker.Check("niece").Result); Assert.IsTrue(spellChecker.Check("friend").Result); }
public void Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { Assert.IsTrue(SpellChecker.Check("priest")); Assert.IsTrue(SpellChecker.Check("fierce")); Assert.IsTrue(SpellChecker.Check("conceive")); Assert.IsTrue(SpellChecker.Check("deceit")); }
/// <summary> /// Checks the spelling of the supplied text and returns a collection of spelling errors. /// </summary> /// <param name="text">The text to check.</param> /// <returns>The result of checking this text, returned as an IEnumerable<SpellingError>.</returns> public IEnumerable <SpellingError> Check(string text) { var errors = spellChecker.Check(text); ISpellingError currentError = null; try { while ((currentError = errors.Next()) != null) { var action = CorrectiveAction.None; switch (currentError.CorrectiveAction) { case CORRECTIVE_ACTION.CORRECTIVE_ACTION_GET_SUGGESTIONS: action = CorrectiveAction.GetSuggestions; break; case CORRECTIVE_ACTION.CORRECTIVE_ACTION_REPLACE: action = CorrectiveAction.Replace; break; case CORRECTIVE_ACTION.CORRECTIVE_ACTION_DELETE: action = CorrectiveAction.Delete; break; } yield return(new SpellingError { StartIndex = (int)currentError.StartIndex, Length = (int)currentError.Length, CorrectiveAction = action, Replacement = currentError.Replacement }); Marshal.ReleaseComObject(currentError); } } finally { if (currentError != null) { Marshal.ReleaseComObject(currentError); } Marshal.ReleaseComObject(errors); } }
public void Check_That_SharpEcho_Is_Misspelled() { var result = SpellChecker.Check("test"); Assert.IsTrue(result); }
public bool Check(string word) { return(_core.Check(word)); }
public void Check_That_IE_Is_Correct() { Assert.IsTrue(SpellChecker.Check("believe")); Assert.IsTrue(SpellChecker.Check("fierce")); Assert.IsTrue(SpellChecker.Check("collie")); Assert.IsTrue(SpellChecker.Check("die")); Assert.IsTrue(SpellChecker.Check("friend")); Assert.IsTrue(SpellChecker.Check("pie")); }
public void Check_Word_That_Contains_I_Before_E_Is_Spelled_Correctly() { var result = SpellChecker.Check("believe"); Assert.That(result, Is.True); }