Esempio n. 1
0
        public async Task DetectImageProperties()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            Assert.Equal(s_allAnnotationsResponse.ImagePropertiesAnnotation, client.DetectImageProperties(s_allAnnotationsImage));
            Assert.Equal(s_allAnnotationsResponse.ImagePropertiesAnnotation, await client.DetectImagePropertiesAsync(s_allAnnotationsImage));
        }
Esempio n. 2
0
        public async Task DetectDocumentText()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            Assert.Equal(s_allAnnotationsResponse.FullTextAnnotation, client.DetectDocumentText(s_allAnnotationsImage));
            Assert.Equal(s_allAnnotationsResponse.FullTextAnnotation, await client.DetectDocumentTextAsync(s_allAnnotationsImage));
        }
Esempio n. 3
0
        public async Task DetectWebInformation()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            Assert.Equal(s_allAnnotationsResponse.WebDetection, client.DetectWebInformation(s_allAnnotationsImage));
            Assert.Equal(s_allAnnotationsResponse.WebDetection, await client.DetectWebInformationAsync(s_allAnnotationsImage));
        }
Esempio n. 4
0
        public async Task DetectSafeSearch()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            Assert.Equal(s_allAnnotationsResponse.SafeSearchAnnotation, client.DetectSafeSearch(s_allAnnotationsImage));
            Assert.Equal(s_allAnnotationsResponse.SafeSearchAnnotation, await client.DetectSafeSearchAsync(s_allAnnotationsImage));
        }
Esempio n. 5
0
        public async Task DetectFaces()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();
            var image = CreateFakeImage(s_allAnnotationsResponse);

            await AssertRepeatedAnnotation(client.DetectFaces, client.DetectFacesAsync, s_allAnnotationsResponse.FaceAnnotations);
        }
Esempio n. 6
0
        public async Task Annotate()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();
            var request = new AnnotateImageRequest
            {
                Image    = s_allAnnotationsImage,
                Features =
                {
                    new Feature {
                        Type = FeatureType.FaceDetection
                    },
                    new Feature {
                        Type = FeatureType.LogoDetection, MaxResults = 1
                    }
                }
            };
            var expectedResponse = new AnnotateImageResponse
            {
                FaceAnnotations = { s_allAnnotationsResponse.FaceAnnotations },
                LogoAnnotations = { s_allAnnotationsResponse.LogoAnnotations.Take(1) }
            };

            Assert.Equal(expectedResponse, client.Annotate(request));
            Assert.Equal(expectedResponse, await client.AnnotateAsync(request));
        }
Esempio n. 7
0
        public async Task DetectLandmarks()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            await AssertRepeatedAnnotation(client.DetectLandmarks, client.DetectLandmarksAsync, s_allAnnotationsResponse.LandmarkAnnotations);
        }
Esempio n. 8
0
        public async Task DetectText()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            await AssertRepeatedAnnotation(client.DetectText, client.DetectTextAsync, s_allAnnotationsResponse.TextAnnotations);
        }