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


C# ITest类代码示例

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


ITest类属于命名空间,在下文中一共展示了ITest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: TestSuiteTreeNode

 /// <summary>
 /// Construct a TestNode given a TestResult
 /// </summary>
 public TestSuiteTreeNode( TestResult result )
     : base(result.Test.TestName.Name)
 {
     this.test = result.Test;
     this.result = result;
     UpdateImageIndex();
 }
开发者ID:scottwis,项目名称:eddie,代码行数:10,代码来源:TestSuiteTreeNode.cs


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