public async Task GetSentimentProperties_TextWordsLessThanMinLength_ReturnsNull() { var sentimentManager = new SentimentManager("text analytics api key", "3", ""); var result = await sentimentManager.GetSentimentProperties("hello"); Assert.IsNull(result); }
public async Task GetSentimentProperties_Http404_ReturnsNull() { var sentimentManager = new SentimentManager("text analytics api key", "", "http://localhost"); var result = await sentimentManager.GetSentimentProperties("hello"); Assert.IsNull(result); }
public async Task GetSentimentProperties_EmptyApiKey_ReturnsNull() { var sentimentManager = new SentimentManager("", "", ""); var result = await sentimentManager.GetSentimentProperties("analyze this text"); Assert.IsNull(result); }
public async Task GetSentimentProperties_Text_ReturnsCorrectScore() { const double expectedScore = 60.0; var sentimentHttpMock = TestUtils.CreateSentimentHttpMock(expectedScore); var sentimentManager = new SentimentManager("text analytics api key", "2", "", sentimentHttpMock.Object); var result = await sentimentManager.GetSentimentProperties("hello world"); Assert.IsNotNull(result); Assert.AreEqual(expectedScore, Convert.ToDouble(result["score"])); }