public async Task PredictSentimentBatchAsyncTest(string key, string endpoint, string language, string query, CliException expectedException) { if (expectedException == null) { // act ITextAnalyticsService predictionService = new TextAnalyticsService(key, endpoint, language); var result = await predictionService.PredictSentimentAsync(query); // assert Assert.NotNull(result); Assert.NotNull(result.ConfidenceScores); Assert.NotNull(result.Sentences); Assert.NotEmpty(result.Sentences); } else { await Assert.ThrowsAsync(expectedException.GetType(), async() => { ITextAnalyticsService predictionService = new TextAnalyticsService(key, endpoint, language); await predictionService.PredictSentimentAsync(query); }); } }