Ejemplo n.º 1
0
        public void GetVisionJobTest()
        {
            var    delay    = 1;
            string jobId    = visionJob.JobId;
            var    response = instance.GetVisionJob(jobId);

            var listener = Task.Factory.StartNew(() =>
            {
                while (response.State.ToString().Equals("PROCESSING"))
                {
                    Thread.Sleep(delay);
                    response = instance.GetVisionJob(jobId);

                    if (response.State.ToString().Equals("DONE"))
                    {
                        break;
                    }
                }
            });

            listener.Wait();

            Assert.IsInstanceOf <VisionJob> (response, "response is VisionJob");
            Assert.AreEqual("DONE", response.State.ToString());
            List <KeyValuePair <string, Result> > resultList = response.Results.ToList();
            List <Tag> labels = resultList.First().Value.Labels;

            Assert.IsTrue(labels.Count >= 1);
        }