示例#1
0
        public void AnalyzeEntitySentiment_InvalidDocumentURL()
        {
            Document document = new Document(DocumentType.PLAIN_TEXT, googleCloudUri: INVALID_DOC_URL);

            Task <Tuple <AnalyzeEntitiesResponse, ResponseStatus> > response = nlIntelligence.AnalyzeEntities(document, EncodingType.UTF8);

            response.Wait();

            Assert.IsNull(response.Result.Item1);
            Assert.AreEqual(response.Result.Item2, NaturalLanguageStatus.INVALID_ARGUMENT);
        }
示例#2
0
        public void AnalyzeEntities_InvalidKey()
        {
            nlIntelligence.UpdateKey(INVALID_SETUP);

            Document document = new Document(DocumentType.PLAIN_TEXT, googleCloudUri: VALID_DOC_URL);

            Task <Tuple <AnalyzeEntitiesResponse, ResponseStatus> > response = nlIntelligence.AnalyzeEntities(document, EncodingType.UTF8);

            response.Wait();

            nlIntelligence.UpdateKey(VALID_SETUP);

            Assert.IsNull(response.Result.Item1);
            Assert.AreEqual(response.Result.Item2, NaturalLanguageStatus.INVALID_API_KEY);
        }