コード例 #1
0
        public async Task ReadImage_Test()
        {
            // Arrange
            var mockLogger       = new Mock <ILogger <CognitiveService> >();
            var cognitiveService = new CognitiveService(mockLogger.Object, AzureCognitiveConfiguration);

            // Act
            var documentTexts = await cognitiveService.ReadImage("Samples\\GlassNegatives_00003.pdf");

            // Assert
            Assert.NotNull(documentTexts);
            Assert.True(documentTexts.Count > 0);
        }
コード例 #2
0
        public async Task <IActionResult> Post(string documentId)
        {
            var document = ArchiveDbContext.Documents.Find(documentId);

            if (document == null)
            {
                return(NotFound());
            }

            // TODO complete the implementation

            var documentTexts = await CognitiveService.ReadImage(document.FileName);


            return(Ok(documentTexts));
        }