Exemple #1
0
        public void AnalyzeSyntax_InvalidKey()
        {
            nlIntelligence.UpdateKey(INVALID_SETUP);

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

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

            response.Wait();

            nlIntelligence.UpdateKey(VALID_SETUP);

            Assert.IsNull(response.Result.Item1);
            Assert.AreEqual(response.Result.Item2, NaturalLanguageStatus.INVALID_API_KEY);
        }
        public void ClassifyText_InvalidKey()
        {
            nlIntelligence.UpdateKey(INVALID_SETUP);

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

            Task <Tuple <ClassifyTextResponse, ResponseStatus> > response = nlIntelligence.ClassifyText(document);

            response.Wait();

            nlIntelligence.UpdateKey(VALID_SETUP);

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