public void TestGetGiphyURL() { string url = giphyService.GetGiphyUrl("happy"); bool httpString = url.StartsWith("https://giphy.com/gifs/"); Assert.IsTrue(httpString); }
public String Post([FromBody] JObject json) { res = json; String bot_id = json.SelectToken("event.bot_id") != null?json.SelectToken("event.bot_id").ToString() : ""; if (bot_id == "") { String text = json.SelectToken("event.text").ToString(); String channel = json.SelectToken("event.channel").ToString(); SentimentResponse sentimentResponse = _aylienService.getSentimentScore(text); String sentiment = sentimentResponse.polarity; if (sentimentResponse.polarity_confidence >= 0.7) { string msg = GetMessageString(ref sentiment); String giphyUrl = _giphyService.GetGiphyUrl(sentiment); String response = _slackService.SendResponseToSlack(channel, giphyUrl, msg); Thread.Sleep(1000); pres = response; return(response); } } pres = "No response as polarity was too low"; return("No response as polarity was too low"); }