コード例 #1
0
ファイル: SmartSuggestionsTests.cs プロジェクト: Jos1k/Roads
        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);
        }
コード例 #2
0
ファイル: RoadsService.cs プロジェクト: Jos1k/Roads
        /// <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>();
            }
        }