Пример #1
0
        public async Task ReturnBadRequestIfEmptyInput()
        {
            var expected = KeyPhraseResult.Build(Constants.KeyPhraseNullInputErrorText);
            var sut      = TextAnalyticsTestHelper.BuildSut(TextAnalyticsTestHelper.GetErrorMessage(Error));

            var result = await sut.GetKeyPhrasesAsync(null);

            Assert.AreEqual(expected, result);
        }
Пример #2
0
        public async Task ReturnFailureOnBadResult()
        {
            var error    = new ErrorMessageGenerator().GenerateError(HttpStatusCode.BadRequest, Error);
            var expected = KeyPhraseResult.Build(error);

            var sut    = TextAnalyticsTestHelper.BuildSut(TextAnalyticsTestHelper.GetErrorMessage(Error));
            var result = await sut.GetKeyPhrasesAsync(Input);

            Assert.AreEqual(expected, result);
        }
Пример #3
0
        public async Task ReturnAllFailureOnBadResult()
        {
            var err      = new ErrorMessageGenerator().GenerateError(HttpStatusCode.BadRequest, Error);
            var expected = new Dictionary <string, SentimentResult>
            {
                { "1", SentimentResult.Build(err) },
                { "2", SentimentResult.Build(err) },
                { "3", SentimentResult.Build(err) },
                { "4", SentimentResult.Build(err) }
            };

            var sut    = TextAnalyticsTestHelper.BuildSut(TextAnalyticsTestHelper.GetErrorMessage(Error));
            var result = await sut.GetBatchSentimentAsync(this._input);

            CollectionAssert.AreEqual(expected, result.ToList());
        }