public SpellingCorrectionTestResult TestWord(MisspellingTest misspellingTest)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var charactersTyped = -1;

            for (var n = 1; n <= misspellingTest.Misspelling.Length; ++n)
            {
                var typedSoFar  = misspellingTest.Misspelling.Substring(0, n);
                var suggestions = autoComplete.GetSuggestions(typedSoFar).Take(NumberOfSuggestionsToCheck);

                if (!suggestions.Any(
                        suggestion =>
                        suggestion.Equals(misspellingTest.TargetWord, StringComparison.CurrentCultureIgnoreCase)))
                {
                    continue;
                }

                charactersTyped = n;
                break;
            }
            stopwatch.Stop();

            var timeTaken = stopwatch.Elapsed;

            return(new SpellingCorrectionTestResult(charactersTyped, timeTaken, misspellingTest));
        }
        public SpellingCorrectionTestResult TestWord(MisspellingTest misspellingTest)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var charactersTyped = -1;
            for (var n = 1; n <= misspellingTest.Misspelling.Length; ++n)
            {
                var typedSoFar = misspellingTest.Misspelling.Substring(0, n);
                var suggestions = autoComplete.GetSuggestions(typedSoFar).Take(NumberOfSuggestionsToCheck);

                if (!suggestions.Any(
                        suggestion =>
                            suggestion.Equals(misspellingTest.TargetWord, StringComparison.CurrentCultureIgnoreCase)))
                {
                    continue;
                }

                charactersTyped = n;
                break;
            }
            stopwatch.Stop();

            var timeTaken = stopwatch.Elapsed;
            return new SpellingCorrectionTestResult(charactersTyped, timeTaken, misspellingTest);
        }
 public SpellingCorrectionTestResult(int charactersTyped, TimeSpan timeTaken, MisspellingTest misspellingTest)
 {
     CharactersTyped = charactersTyped;
     TimeTaken = timeTaken;
     this.misspellingTest = misspellingTest;
 }
 public SpellingCorrectionTestResult(int charactersTyped, TimeSpan timeTaken, MisspellingTest misspellingTest)
 {
     CharactersTyped      = charactersTyped;
     TimeTaken            = timeTaken;
     this.misspellingTest = misspellingTest;
 }