void handlePlayButtonClick() { string wordPlayed = gameState.GetWordToPlay(); if (wordPlayed.Length < 3) { return; } List <LetterTileModel> inPlayTiles = gameState.GetInPlayTiles(); bool valid = SpellChecker.CheckWord(wordPlayed.ToLower()); if (valid) { while (inPlayTiles.Count > 0) { KillTile(inPlayTiles[0]); } } else { while (inPlayTiles.Count > 0) { removeTileFromPlay(inPlayTiles[0]); } } gameState.ClearTilesInPlay(); }
public void WordIsCorrectIfInDictionaryIgnoreCase() { Assert.That(SpellChecker.CheckWord("абвгдеж", new string[] { "абвж", "АБВГдеж" }), Is.EqualTo("АБВГдеж")); }
public void MoreThanOneCorrectionWithEditDistTwoAndChangedOrderInDict() { Assert.That(SpellChecker.CheckWord("Two", new string[] { "tewot", "van", "too", "three" }), Is.EqualTo("{tewot too}")); }
public void MoreThanOneEditCorrection() { Assert.That(SpellChecker.CheckWord("Three", new string[] { "van", "Tree", "Threek", "Threk", "sthree" }), Is.EqualTo("{Tree Threek sthree}")); }
public void OneEditCorrection() { Assert.That(SpellChecker.CheckWord("Abcde", new string[] { "van", "abcdef", "abcdf" }), Is.EqualTo("abcdef")); }
public void NoCorrections() { Assert.That(SpellChecker.CheckWord("abcdefg", new string[] { "van", "abcdr" }), Is.EqualTo("{abcdefg?}")); }