public void TestDetectTextForValidResponse()
 {
     var sample = new GoogleCloudSamples.TextDetectionSample();
     VisionService vision = sample.CreateAuthorizedClient();
     var result =
         sample.DetectText(vision, @"..\..\..\data\succulents.jpg");
     // Confirm that DetectText returns expected result for test image.
     var response = result[0];
     var text = response.TextAnnotations[0];
     Assert.IsNotNull(text.Description);
     Assert.IsTrue(text.Description.Contains("Succulents"));
 }
 public void TestDetectTextForImageContainingNoText()
 {
     var sample = new GoogleCloudSamples.TextDetectionSample(); ;
     VisionService vision = sample.CreateAuthorizedClient();
     // Confirm text isn't found for image that contains no text.
     var result = sample.DetectText(vision,
         @"..\..\..\data\no-text.jpg");
     if (result[0].Error == null)
     {
         Assert.IsNull(result[0].TextAnnotations);
     }
 }
Exemple #3
0
        public void TestDetectTextForImageContainingNoText()
        {
            var           sample = new GoogleCloudSamples.TextDetectionSample();;
            VisionService vision = sample.CreateAuthorizedClient();
            // Confirm text isn't found for image that contains no text.
            var result = sample.DetectText(vision,
                                           @"..\..\..\test\data\no-text.jpg");

            if (result[0].Error == null)
            {
                Assert.IsNull(result[0].TextAnnotations);
            }
        }
Exemple #4
0
        public void TestDetectTextForValidResponse()
        {
            var           sample = new GoogleCloudSamples.TextDetectionSample();
            VisionService vision = sample.CreateAuthorizedClient();
            var           result =
                sample.DetectText(vision, @"..\..\..\test\data\succulents.jpg");
            // Confirm that DetectText returns expected result for test image.
            var response = result[0];
            var text     = response.TextAnnotations[0];

            Assert.IsNotNull(text.Description);
            Assert.IsTrue(text.Description.Contains("Succulents"));
        }
 public void TestDetectTextForInvalidImage()
 {
     var sample = new GoogleCloudSamples.TextDetectionSample(); ;
     VisionService vision = sample.CreateAuthorizedClient();
     // Confirm text isn't found for invalid image
     // and that it throws an exception.
     var result = sample.DetectText(vision,
         @"..\..\..\data\not-an-image.txt");
     var response = result[0];
     var text = response.TextAnnotations[0];
     if (!String.IsNullOrEmpty(text.Description))
     {
         Assert.Fail();
     }
 }
Exemple #6
0
        public void TestDetectTextForInvalidImage()
        {
            var           sample = new GoogleCloudSamples.TextDetectionSample();;
            VisionService vision = sample.CreateAuthorizedClient();
            // Confirm text isn't found for invalid image
            // and that it throws an exception.
            var result = sample.DetectText(vision,
                                           @"..\..\..\test\data\not-an-image.txt");
            var response = result[0];
            var text     = response.TextAnnotations[0];

            if (!String.IsNullOrEmpty(text.Description))
            {
                Assert.Fail();
            }
        }