• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ITest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ProcessTestCases

        private int ProcessTestCases(ITest test, ITestCaseDiscoverySink discoverySink, TestConverter testConverter)
        {
            int cases = 0;

            if (test.IsSuite)
            {
                foreach (ITest child in test.Tests)
                    cases += ProcessTestCases(child, discoverySink,testConverter);
            }
            else
            {
                try
                {
            #if LAUNCHDEBUGGER
            Debugger.Launch();
            #endif
                    TestCase testCase = testConverter.ConvertTestCase(test);

                    discoverySink.SendTestCase(testCase);
                    cases += 1;
                }
                catch (System.Exception ex)
                {
                    testLog.SendErrorMessage("Exception converting " + test.TestName.FullName, ex);
                }
            }

            return cases;
        }
开发者ID:rprouse,项目名称:nunit-vs-adapter,代码行数:29,代码来源:NUnitTestDiscoverer.cs


示例2: RunTest

        protected static void RunTest(ITest test)
        {
            int loops = Calibrate(test, TimeSpan.FromMilliseconds(1000));

            var sw = new Stopwatch();

            GC.Collect();
            GC.WaitForPendingFinalizers();

            var c1 = GC.CollectionCount(0);
            var c2 = GC.CollectionCount(1);
            var c3 = GC.CollectionCount(2);

            sw.Start();
            test.DoTest(loops);
            sw.Stop();

            c1 = GC.CollectionCount(0) - c1;
            c2 = GC.CollectionCount(1) - c2;
            c3 = GC.CollectionCount(2) - c3;

            var lps = (int)(loops / (sw.ElapsedMilliseconds / 1000.0));

            Console.WriteLine("{0,-40} {1,20} loops/s, collections {2}/{3}/{4}",
                test.GetType().Name, lps,
                c1, c2, c3);
        }
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:27,代码来源:Program.cs


示例3: BuildStackTrace

        private static string BuildStackTrace(Exception exception, ITest test, IEnumerable<string> traceMessages)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("SPECIFICATION:");
            if (test.Properties.Contains(TestExtensions.MultilineNameProperty))
            {
                foreach (var line in ((string)test.Properties[TestExtensions.MultilineNameProperty]).Split('\n'))
                    sb.AppendLine("    " + line);
            }

            sb.AppendLine();

            if (traceMessages.Count() > 0)
            {
                foreach (var line in traceMessages)
                    sb.AppendLine(line);

                sb.AppendLine();
            }

            sb.AppendLine(GetStackTrace(exception));

            for (Exception innerException = exception.InnerException; innerException != null; innerException = innerException.InnerException)
            {
                sb.Append(Environment.NewLine);
                sb.Append("--");
                sb.Append(innerException.GetType().Name);
                sb.Append(Environment.NewLine);
                sb.Append(GetStackTrace(innerException));
            }
            return sb.ToString();
        }
开发者ID:guyzo,项目名称:DreamNJasmine,代码行数:33,代码来源:TestResultUtil.cs


示例4: TestUnitWithMetadata

 /// <summary>
 /// Initializes a new instance of the <see cref="TestUnitWithMetadata"/> class.
 /// </summary>
 /// <param name="testRun">The test run.</param>
 /// <param name="test"></param>
 /// <param name="assemblyName">Name of the assembly.</param>
 /// <param name="children">The children.</param>
 public TestUnitWithMetadata(TestRun testRun, ITest test, string assemblyName, List<TestUnitWithMetadata> children = null)
 {
     Children = children ?? new List<TestUnitWithMetadata>();
     Test = new TestUnit(test, testRun, assemblyName);
     Results = new List<TestResult>();
     AttachedData = new TestUnitAttachedData();
 }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:14,代码来源:TestUnitWithMetadata.cs


示例5: AddCategories

		public void AddCategories( ITest test )
		{
            if (test.Categories != null)
                foreach (string name in test.Categories)
                    if (NUnitFramework.IsValidCategoryName(name))
                        Add(name);
		}
开发者ID:Buildstarted,项目名称:ContinuousTests,代码行数:7,代码来源:CategoryManager.cs


示例6: Failed

 public static ITestResult Failed(
     ITest		test,
     string		message,
     Exception	t)
 {
     return new SimpleTestResult(false, test.Name + ": " + message, t);
 }
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:7,代码来源:SimpleTestResult.cs


示例7: WriteTestFile

 /// <summary>
 /// Writes test info to a file
 /// </summary>
 /// <param name="test">The test to be written</param>
 /// <param name="outputPath">Path to the file to which the test info is written</param>
 public void WriteTestFile(ITest test, string outputPath)
 {
     using (StreamWriter writer = new StreamWriter(outputPath, false, Encoding.UTF8))
     {
         WriteTestFile(test, writer);
     }
 }
开发者ID:balaghanta,项目名称:nunit-framework,代码行数:12,代码来源:OutputWriter.cs


示例8: Queue

        public static void Queue(
            this IMessageBus messageBus,
            ITest test,
            Func<ITest, IMessageSinkMessage> createTestResultMessage,
            CancellationTokenSource cancellationTokenSource)
        {
            Guard.AgainstNullArgument("messageBus", messageBus);
            Guard.AgainstNullArgument("createTestResultMessage", createTestResultMessage);
            Guard.AgainstNullArgument("cancellationTokenSource", cancellationTokenSource);

            if (!messageBus.QueueMessage(new TestStarting(test)))
            {
                cancellationTokenSource.Cancel();
            }
            else
            {
                if (!messageBus.QueueMessage(createTestResultMessage(test)))
                {
                    cancellationTokenSource.Cancel();
                }
            }

            if (!messageBus.QueueMessage(new TestFinished(test, 0, null)))
            {
                cancellationTokenSource.Cancel();
            }
        }
开发者ID:mvalipour,项目名称:xbehave.dnx.test,代码行数:27,代码来源:MessageBusExtensions.cs


示例9: TestStarted

 /// <summary>
 /// Forwards the TestStarted event to all listeners.
 /// </summary>
 /// <param name="test">The test that just started.</param>
 public void TestStarted(ITest test)
 {
     System.Diagnostics.Debug.WriteLine(test.Name + " TEST STARTED");
     System.Threading.Thread.Sleep(2000);
     foreach (TestListener listener in listeners)
         listener.TestStarted(test);
 }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:11,代码来源:TestRunner.cs


示例10: OrganizationService

        public OrganizationService(ITest test)
        {
            if(test == null)
                throw new ArgumentNullException("test");

            this._test = test;
        }
开发者ID:HansKindberg-Net,项目名称:WCF-Enabled-WebApplication-With-ConstructorInjection-Lab,代码行数:7,代码来源:OrganizationService.cs


示例11: AddAllCategories

		public void AddAllCategories( ITest test )
		{
			AddCategories( test );
			if ( test.IsSuite )
				foreach( ITest child in test.Tests )
					AddAllCategories( child );
		}
开发者ID:Buildstarted,项目名称:ContinuousTests,代码行数:7,代码来源:CategoryManager.cs


示例12: NewTestResultSummaryEventArgs

 public NewTestResultSummaryEventArgs(ITest test, ITestResult result, ITestOutcomeFilter outcomeFilter, ITestResultSummary summary)
 {
     Test = test;
     Result = result;
     OutcomeFilter = outcomeFilter;
     Summary = summary;
 }
开发者ID:slang25,项目名称:SimpleSpeedTester,代码行数:7,代码来源:NewTestResultSummaryEventArgs.cs


示例13: 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


示例14: TestStarted

 public void TestStarted(ITest test)
 {
     level++;
     prefix = new string('>', level);
     if(options.DisplayTestLabels == "On" || options.DisplayTestLabels == "All")
         outWriter.WriteLine("{0} {1}", prefix, test.Name);
 }
开发者ID:TannerBaldus,项目名称:test_accelerator,代码行数:7,代码来源:TestEventListener.cs


示例15: BeforeTest

        public void BeforeTest(ITest test)
        {
            //Log.Write("START:" + test.FullName);
            if (!_configuration.GenerateReport) return;

            _start = DateTime.Now;
        }
开发者ID:TomDrJones,项目名称:NUnitGo,代码行数:7,代码来源:NunitGoActionAttribute.cs


示例16: AddTest

        public void AddTest(ITest test)
        {
            if(test == null) throw new ArgumentNullException("test");

            tests.Add(test);
            test.TestCompleted += TestOnTestCompleted;
        }
开发者ID:etinquis,项目名称:gtest-gbar-1,代码行数:7,代码来源:GTestTestCase.cs


示例17: TestStarted

 /// <summary>
 /// Called when a test has just started
 /// </summary>
 /// <param name="test">The test that is starting</param>
 public void TestStarted(ITest test)
 {
     if (test.IsSuite)
         TC_TestSuiteStarted(test.Name);
     else
         TC_TestStarted(test.Name);
 }
开发者ID:nunit,项目名称:nunit,代码行数:11,代码来源:TeamCityEventListener.cs


示例18: Execute

        private void Execute(ITest test, string methodPrefix)
        {
            var method = Reflect.GetNamedMethod(_ActionInterfaceType, methodPrefix + "Test");
            var details = CreateTestDetails(test);

            Reflect.InvokeMethod(method, _Action, details);
        }
开发者ID:rmterra,项目名称:AutoTest.Net,代码行数:7,代码来源:TestAction.cs


示例19: Match

		/// <summary>
		/// Check whether the filter matches a test
		/// </summary>
		/// <param name="test">The test to be matched</param>
		/// <returns>True if it matches, otherwise false</returns>
		public override bool Match( ITest test )
		{
            if (topLevel && test.RunState == RunState.Explicit)
                return false;

			return !baseFilter.Pass( test );
		}
开发者ID:Buildstarted,项目名称:ContinuousTests,代码行数:12,代码来源:NotFilter.cs


示例20: EvaluateWithTest

    //public AlgorithmEvaluator(AlgorithmExecutor executor, ICollection<ITest> tests, IAnswerEvaluator answerEvaluator, TimeSpan timeLimit) : this(tests, answerEvaluator, timeLimit)
    //{
    //    this.executor = executor;
    //}
    //public AlgorithmEvaluator(string algorithmFolder, ICollection<ITest> tests, IAnswerEvaluator answerEvaluator, TimeSpan timeLimit)
    //    : this(new AlgorithmExecutor(algorithmFolder), tests, answerEvaluator, timeLimit)
    //{
    //}
    //public void SetAlgorithm(AlgorithmExecutor newAlg)
    //{
    //    this.executor = newAlg;
    //}
    public int EvaluateWithTest(AlgorithmExecutor algorithm, ITest test, bool allowTimeLimit = false)
    {
        this.logWriter.WriteLine();
        this.logWriter.WriteLine("Evaluating {0} with test {1}", algorithm.AlgorithmOwner, test.Name);

        try
        {
            algorithm.StartAlgorithm();
        }
        catch (Win32Exception)
        {
            this.logWriter.WriteLine("--couldn't start algorithm");
            return 0;
        }

        DateTime start = DateTime.Now;

        string algorithmAnswer = "";
        try
        {
            Task<string> algorithmAnswerTask = Task.Run(() => algorithm.GetAnswerToInput(test.Input));

            bool timeLimitReached = false;
            //Console.WriteLine("press enter");
            //Console.ReadLine();
            System.Threading.Thread.Sleep(timeLimit - TimeSpan.FromMilliseconds(100));
            while (!algorithmAnswerTask.IsCompleted)
            {
                TimeSpan elapsed = DateTime.Now - start;
                if (elapsed > timeLimit)
                {
                    this.logWriter.WriteLine("--time limit reached, killing algorithm");
                    algorithm.KillAlgorithm();
                    timeLimitReached = true;
                    break;
                }
            }

            if (!timeLimitReached || allowTimeLimit)
            {
                this.logWriter.WriteLine("--attempting to retrieve output from algorithm");
                algorithmAnswerTask.Wait();
                algorithmAnswer += algorithmAnswerTask.Result;
            }
            else
            {
                return 0;
            }

            algorithm.KillAlgorithm(); //just in case
        }
        catch (Exception e)
        {
            this.logWriter.WriteLine("--unexpected error while evaluating: {0}", e.Message);
        }

        this.logWriter.Write("--algorithm output:\r\n{0}\r\n", algorithmAnswer);
        return this.evaluator.EvaluateAnswer(algorithmAnswer, test.Input, test.ExpectedOutput);
    }
开发者ID:psotirov,项目名称:PCMagazine,代码行数:71,代码来源:AlgorithmEvaluator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITestCase类代码示例发布时间:2022-05-24
下一篇:
C# ITerrainChannel类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap