Exemplo n.º 1
0
 public void TestDetectLabelsForValidResponse()
 {
     var sample = new GoogleCloudSamples.LabelDetectionSample();
     VisionService vision = sample.CreateAuthorizedClient();
     var result = sample.DetectLabels(vision, @"..\..\..\data\cat.jpg");
     // Confirm that DetectLabels returns expected result for test image.
     var response = result[0];
     var label = response.LabelAnnotations[0];
     Assert.IsNotNull(label.Description);
     Assert.IsTrue(label.Description.Contains("cat"));
 }
Exemplo n.º 2
0
        public void TestDetectLabelsForValidResponse()
        {
            var           sample = new GoogleCloudSamples.LabelDetectionSample();
            VisionService vision = sample.CreateAuthorizedClient();
            var           result = sample.DetectLabels(vision, @"..\..\..\data\cat.jpg");
            // Confirm that DetectLabels returns expected result for test image.
            var response = result[0];
            var label    = response.LabelAnnotations[0];

            Assert.IsNotNull(label.Description);
            Assert.IsTrue(label.Description.Contains("cat"));
        }
Exemplo n.º 3
0
 public void TestDetectLabelsForInvalidImage()
 {
     var sample = new GoogleCloudSamples.LabelDetectionSample();
     VisionService vision = sample.CreateAuthorizedClient();
     // Confirm invalid image doesn't get labels and throws an exception
     var result = sample.DetectLabels(vision, @"..\..\..\data\bad.txt");
     var response = result[0];
     var label = response.LabelAnnotations[0];
     if (!String.IsNullOrEmpty(label.Description))
     {
         Assert.Fail();
     }
 }
Exemplo n.º 4
0
        public void TestDetectLabelsForInvalidImage()
        {
            var           sample = new GoogleCloudSamples.LabelDetectionSample();
            VisionService vision = sample.CreateAuthorizedClient();
            // Confirm invalid image doesn't get labels and throws an exception
            var result   = sample.DetectLabels(vision, @"..\..\..\data\bad.txt");
            var response = result[0];
            var label    = response.LabelAnnotations[0];

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