Exemple #1
0
        public async void Should_ThrowException_When_CallTextClassificationWithWrongParameters(TextClassificationParameters parameters, string message, string wrongParameter)
        {
            //Act & Assert

            ArgumentException ex = await Assert.ThrowsAsync <ArgumentException>(() => _textClassificationService.CallTextClassificationAsync(parameters));

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