Пример #1
0
        /// <exception cref="System.Exception"/>
        public virtual void WaitForState(Task task, TaskState finalState)
        {
            int        timeoutSecs = 0;
            TaskReport report      = task.GetReport();

            while (!finalState.Equals(report.GetTaskState()) && timeoutSecs++ < 20)
            {
                System.Console.Out.WriteLine("Task State for " + task.GetID() + " is : " + report
                                             .GetTaskState() + " Waiting for state : " + finalState + "   progress : " + report
                                             .GetProgress());
                report = task.GetReport();
                Sharpen.Thread.Sleep(500);
            }
            System.Console.Out.WriteLine("Task State is : " + report.GetTaskState());
            NUnit.Framework.Assert.AreEqual("Task state is not correct (timedout)", finalState
                                            , report.GetTaskState());
        }