Ejemplo n.º 1
0
        public void SmartSuggestionsManager_GetSuggestions_SendText_GetList(string entries, string keyboard, int languageId, int numberOfMatches)
        {
            //arrange
            var repository = new MapObjectTranslationsRepository(_datacontext);

            var manager = new SmartSuggestionsManager(repository);

            //act

            var result = manager.GetSuggestions(entries, languageId, 10).Count();

            //assert
            Assert.IsTrue(result == numberOfMatches);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Return array of suggestions retrieved from database.
        /// </summary>
        /// <param name="searchString">The search string.</param>
        /// <param name="language">The language string.</param>
        /// <returns>Returns array of suggestions.</returns>
        public List<Suggestion> GetSuggestions(string searchString, string language)
        {
            try
            {
                var manager = new SmartSuggestionsManager();

                int languageId = new LanguagesManager().GetLanguageId(language);

                return manager.GetSuggestions(searchString, languageId, 20);
            }
            catch (Exception ex)
            {
                return new List<Suggestion>();
            }
        }