public async void Should_ThrowException_When_CallSentimentAnalysisWithWrongParameters(SentimentAnalysisParameters parameters, string message, string wrongParameter)
        {
            //Act & Assert

            ArgumentException ex = await Assert.ThrowsAsync <ArgumentException>(() => _sentimentAnalysisService.CallSentimentAnalysisAsync(parameters));

            if (String.IsNullOrEmpty(wrongParameter))
            {
                Assert.Equal(message, ex.Message);
            }
            else
            {
                Assert.Equal($"{message}{Environment.NewLine}Parameter name: {wrongParameter}", ex.Message);
            }
        }
Example #2
0
 /// <summary>
 ///     Asyncronous method that call <see href="https://dandelion.eu/docs/api/datatxt/sent/v1/">Sentiment Analysis end-point</see> on a text source
 /// </summary>
 /// <param name="parameters"> Parameters to specify all options for the Sentiment Analysis process </param>
 /// <returns>Returns a <c>SentimentAnalysisDto</c> populated with the result of the Sentiment Analysis process </returns>
 /// <seealso cref="SentimentAnalysisDto"/>
 public static Task <SentimentAnalysisDto> AnalyzeSentimentsAsync(SentimentAnalysisParameters parameters)
 {
     Init();
     return(_sentimentAnalysisService.CallSentimentAnalysisAsync(parameters));
 }