public void GetRandomWords_NoArgs_NotEmpty()
        {
            var randomWordsService = new RandomWordsService();

            string randomWord = randomWordsService.GetRandomWords();

            Assert.NotEmpty(randomWord);
        }
        public string GetInfo(string command)
        {
            string userWords = GetUserWords(command);

            if (string.IsNullOrEmpty(userWords))
            {
                string randomWords    = _randomWordsService.GetRandomWords();
                string randomImageUrl = GetRandomImageUrl(randomWords + TrashKeyword);

                return(randomWords
                       + _skypeLineSeparator
                       + randomImageUrl);
            }

            return(GetRandomImageUrl(userWords));
        }
示例#3
0
        public void CanGetRandomNouns()
        {
            var request = new GetRandomWordsRequest("");

            request.MinCorpusCount       = 100000;
            request.ExcludePartsOfSpeech = new List <PartOfSpeech>()
            {
                PartOfSpeech.ProperNoun, PartOfSpeech.ProperNounPlural, PartOfSpeech.ProperNounPossesive, PartOfSpeech.Suffix, PartOfSpeech.FamilyName, PartOfSpeech.GivenName, PartOfSpeech.Idiom, PartOfSpeech.Affix, PartOfSpeech.NounPlural, PartOfSpeech.NounPossessive
            };
            request.IncludePartsOfSpeech = new List <PartOfSpeech>()
            {
                PartOfSpeech.Noun
            };
            request.Limit         = 25;
            request.MaximumLength = 10;

            var service  = new RandomWordsService(new GetWordnikBaseUrlQuery());
            var response = service.GetRandomWords(request);

            Console.WriteLine(string.Join(", ", response.Words.Select(w => w.Word)));
        }