当前位置: 首页>>代码示例>>C#>>正文


C# ITest.Test方法代码示例

本文整理汇总了C#中ITest.Test方法的典型用法代码示例。如果您正苦于以下问题:C# ITest.Test方法的具体用法?C# ITest.Test怎么用?C# ITest.Test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITest的用法示例。


在下文中一共展示了ITest.Test方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunTest

        public static void RunTest(TestType type, int ThreadCount, CallbackFunction callBack, ITest target)
        {
            for (int i = 0; i < ThreadCount; i++)
            {
                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (object sender, DoWorkEventArgs e) =>
                {
                    bool result = target.Test();
                    e.Result = result;

                };

                worker.RunWorkerCompleted += (object sender, RunWorkerCompletedEventArgs e) =>
                    {
                        if (callBack != null)
                        {
                            if (e.Error != null)
                            {
                                callBack(type, (bool)e.Result);
                            }
                            else
                            {
                                callBack(type, false);
                            }
                        }
                    };
                worker.RunWorkerAsync();
            }
        }
开发者ID:shakasi,项目名称:shakasi.github.com,代码行数:29,代码来源:Utility.cs

示例2: RunTest

 private static void RunTest(Options o, string subTest, Action<string> logger, ITest test, int i)
 {
     TestResultBase result = null;
     try
     {
         result = test.Test(o);
         result.StepNr = i;
         result.SubTest = subTest;
     }
     catch (Exception ex)
     {
         if (result == null)
         {
             result = new GenericTestResult();
         }
         result.StepNr = i;
         result.SubTest = subTest;
         result.Status = TestResult.FAIL;
         result.CauseOfFailure = ex.Message;
         result.ExtraInformation = ex.StackTrace;
     }
     if (logger != null)
         logger(result.ToString());
 }
开发者ID:Be-MobileNV,项目名称:KvTestingTools,代码行数:24,代码来源:RunTesterBase.cs

示例3: RunTest

        private static void RunTest(ITest Test)
        {
            try
            {
                Test.Progress -= OnTestProgress;
                Test.Progress += new EventHandler<TestEventArgs>(OnTestProgress);
                Console.WriteLine(Test.Description);
                Console.WriteLine(Test.Test());
                Console.WriteLine();
            }
            catch (Exception Ex)
            {
                Console.WriteLine("An error has occured!");
                Console.WriteLine(Ex.Message);
                Console.WriteLine("");
                Console.WriteLine("Continue Testing? Press 'Y' to continue, all other keys abort..");
                ConsoleKeyInfo keyInfo = Console.ReadKey();

                if (!keyInfo.Key.Equals(ConsoleKey.Y))
                    Environment.Exit(0);
                else
                    Console.WriteLine();
            }
        }
开发者ID:jesusgarza,项目名称:McEliece-Sharp,代码行数:24,代码来源:Program.cs

示例4: PerformTest

 private static void PerformTest(ITest test)
 {
     Log("Performing test: " + test.Name);
     long startTime = new NativeDate().GetTime();
     test.Test();
     long deltaTime = new NativeDate().GetTime() - startTime;
     if (test.Passed)
     {
         _passCount++;
         Log("Test: " + test.Name + " [PASSED]: " + deltaTime + " ms");
     }
     else
     {
         Log("Test: " + test.Name + " [FAILED]: " + deltaTime + " ms => " + test.Exception + " - " + test.Exception.StackTrace);
         _failures.Add(test);
     }
     // TODO: ConditionalExpression "test.Passsed?'PASSED':'FAILED'" was producing either "undefined" or "'FAILED'" need regression test for it
 }
开发者ID:sidecut,项目名称:xaeios,代码行数:18,代码来源:TestRunner.cs


注:本文中的ITest.Test方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。