예제 #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"));
 }
예제 #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"));
        }
예제 #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();
     }
 }
예제 #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();
            }
        }