示例#1
0
        private static bool DoTest(Test test, string note = null)
        {
            try
            {
                Console.WriteLine("Testing: " + test.Method.ToString());
                if (note != null)
                {
                    Console.WriteLine("Note: " + note);
                }

                test.Invoke();

                Console.WriteLine("=> OK");
                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine("=> ERROR");
                return false;
            }
        }
示例#2
0
        private static bool waitFor(Test t, int timeout)
        {
            DateTime start = DateTime.Now;

            while (DateTime.Now.Subtract(start).Seconds < timeout)
            {
                if (t.Invoke())
                {
                    return true;
                }

                Thread.Sleep(10);
            }

            return false;
        }