public async Task PredictSentimentBatchAsyncTest(string key, string endpoint, string language, List <string> queries, CliException expectedException) { if (expectedException == null) { // act ITextAnalyticsService predictionService = new TextAnalyticsService(key, endpoint, language); var result = await predictionService.PredictSentimentBatchAsync(queries); // assert Assert.NotNull(result); Assert.NotEmpty(result); foreach (AnalyzeSentimentResult r in result) { Assert.NotNull(r.DocumentSentiment); Assert.NotNull(r.DocumentSentiment.ConfidenceScores); Assert.NotNull(r.DocumentSentiment.Sentences); Assert.NotEmpty(r.DocumentSentiment.Sentences); } } else { await Assert.ThrowsAsync(expectedException.GetType(), async() => { ITextAnalyticsService predictionService = new TextAnalyticsService(key, endpoint, language); await predictionService.PredictSentimentBatchAsync(queries); }); } }