Example #1
0
        public async Task PredictKeyphraseBatchAsyncTest(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.PredictKeyphraseBatchAsync(queries);

                // assert
                Assert.NotNull(result);
                Assert.NotEmpty(result);
                foreach (ExtractKeyPhrasesResult r in result)
                {
                    Assert.NotNull(r.KeyPhrases);
                    Assert.NotEmpty(r.KeyPhrases);
                }
            }
            else
            {
                await Assert.ThrowsAsync(expectedException.GetType(), async() =>
                {
                    ITextAnalyticsService predictionService = new TextAnalyticsService(key, endpoint, language);
                    await predictionService.PredictKeyphraseBatchAsync(queries);
                });
            }
        }