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


C# ITestFilter.Pass方法代码示例

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


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

示例1: CountTestCases

		public override int CountTestCases( ITestFilter filter ) 
		{
			if (filter.Pass(this))
				return 1;

			return 0;
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:TestCase.cs

示例2: RunAllTests

        private void RunAllTests(
            TestSuiteResult suiteResult, EventListener listener, ITestFilter filter)
        {
            foreach (Test test in ArrayList.Synchronized(Tests))
            {
                if (filter.Pass(test))
                {
                    RunState saveRunState = test.RunState;

                    if (test.RunState == RunState.Runnable && this.RunState != RunState.Runnable && this.RunState != RunState.Explicit )
                    {
                        test.RunState = this.RunState;
                        test.IgnoreReason = this.IgnoreReason;
                    }

                    TestResult result = test.Run(listener, filter);

                    suiteResult.AddResult(result);

                    if (saveRunState != test.RunState)
                    {
                        test.RunState = saveRunState;
                        test.IgnoreReason = null;
                    }
                }
            }
        }
开发者ID:fotisp,项目名称:conqat,代码行数:27,代码来源:TestSuite.cs

示例3: MarkTestsNotRun

 private void MarkTestsNotRun(
     IList tests, RunState runState, string ignoreReason, TestSuiteResult suiteResult, EventListener listener, ITestFilter filter)
 {
     foreach (Test test in ArrayList.Synchronized(tests))
     {
         if (filter.Pass(test))
             MarkTestNotRun(test, runState, ignoreReason, suiteResult, listener, filter);
     }
 }
开发者ID:fotisp,项目名称:conqat,代码行数:9,代码来源:TestSuite.cs

示例4: MarkTestsFailed

 private void MarkTestsFailed(
     IList tests, TestSuiteResult suiteResult, EventListener listener, ITestFilter filter)
 {
     foreach (Test test in ArrayList.Synchronized(tests))
         if (filter.Pass(test))
             MarkTestFailed(test, suiteResult, listener, filter);
 }
开发者ID:fotisp,项目名称:conqat,代码行数:7,代码来源:TestSuite.cs

示例5: CountTestCases

        public override int CountTestCases(ITestFilter filter)
        {
            int count = 0;

            if(filter.Pass(this))
            {
                foreach(Test test in Tests)
                {
                    count += test.CountTestCases(filter);
                }
            }
            return count;
        }
开发者ID:fotisp,项目名称:conqat,代码行数:13,代码来源:TestSuite.cs

示例6: CountTestCases

		/// <summary>
		/// Counts the test cases that would be run if this
		/// test were executed using the provided filter.
		/// </summary>
		/// <param name="filter">The filter to apply</param>
		/// <returns>A count of test cases</returns>
        public virtual int CountTestCases(ITestFilter filter)
        {
            if (filter.IsEmpty)
                return TestCount;

            if (!isSuite)
                return filter.Pass(this) ? 1 : 0;

            int count = 0;
            if (filter.Pass(this))
            {
                foreach (ITest test in Tests)
                {
                    count += test.CountTestCases(filter);
                }
            }
            return count;
        }
开发者ID:Phaiax,项目名称:dotnetautoupdate,代码行数:24,代码来源:TestInfo.cs

示例7: CountTestCases

        private int CountTestCases(ITest test, ITestFilter filter)
        {
            if (!test.IsSuite)
                return 1;
            
            int count = 0;
            foreach (ITest child in test.Tests)
                if (filter.Pass(child))
                    count += CountTestCases(child, filter);

            return count;
        }
开发者ID:jeme,项目名称:nunit-framework,代码行数:12,代码来源:DefaultTestAssemblyRunner.cs

示例8: InternalRun

        protected virtual TestResult InternalRun(ITestFilter filter, TestResult result)
        {
            if (this.runInParallel)
            {
                foreach (TestRunner runner in runners)
                    if (filter.Pass(runner.Test))
                        runner.BeginRun(this, filter);

                result = this.EndRun();
            }
            else
            {
                foreach (TestRunner runner in runners)
                    if (filter.Pass(runner.Test))
                        result.AddResult(runner.Run(this, filter));
            }
            return result;
        }
开发者ID:kurman,项目名称:mt-nunit-console,代码行数:18,代码来源:AggregatingTestRunner.cs

示例9: FindTestUnits

        private static void FindTestUnits(ITest test, ITestFilter filter,
                                          List<TestUnitWithMetadata> result, TestRun testRun, string assemblyName = null)
        {
            var assembly = test as TestAssembly;

            if (assembly != null)
                assemblyName = assembly.TestName.FullName;

            if (filter.Pass(test))
            {
                var isTestSuiteWithAtLeastOneTestMethod = (test.IsSuite && test.Tests != null && test.Tests.Count != 0 &&
                                                           !((ITest) test.Tests[0]).IsSuite);

                if (!test.IsSuite || isTestSuiteWithAtLeastOneTestMethod)
                {
                    List<TestUnitWithMetadata> subTests = null;
                    if (test.IsSuite && test.Tests != null)
                    {
                        subTests = new List<TestUnitWithMetadata>();
                        foreach (ITest child in test.Tests)
                        {
                            FindTestUnits(child, filter, subTests, testRun, assemblyName);
                        }
                    }
                    var testUnitWithMetadata = new TestUnitWithMetadata(testRun, test, assemblyName, subTests);
                    result.Add(testUnitWithMetadata);
                }
                else if ((test.Tests != null && test.Tests.Count > 0))
                {
                    foreach (ITest child in test.Tests)
                    {
                        FindTestUnits(child, filter, result, testRun, assemblyName);
                    }
                }
            }
        }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:36,代码来源:TestsRetriever.cs

示例10: CountTestCases

        /// <summary>
        /// Gets a count of test cases that would be run using
        /// the specified filter.
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        public virtual int CountTestCases(ITestFilter filter)
        {
            if (filter.Pass(this))
                return 1;

            return 0;
        }
开发者ID:scottwis,项目名称:eddie,代码行数:13,代码来源:Test.cs

示例11: RunAllTests

        private void RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter )
		{
            if (Properties.Contains("Timeout"))
                TestExecutionContext.CurrentContext.TestCaseTimeout = (int)Properties["Timeout"];

            IDictionary settings = TestExecutionContext.CurrentContext.TestPackage.Settings;
            bool stopOnError = settings.Contains("StopOnError") && (bool)settings["StopOnError"];

            foreach (Test test in ArrayList.Synchronized(Tests))
            {
                if (filter.Pass(test))
                {
                    RunState saveRunState = test.RunState;

                    if (test.RunState == RunState.Runnable && this.RunState != RunState.Runnable && this.RunState != RunState.Explicit )
                    {
                        test.RunState = this.RunState;
                        test.IgnoreReason = this.IgnoreReason;
                    }

                    TestResult result = test.Run(listener, filter);

					log.Debug("Test result = " + result.ResultState);
					
                    suiteResult.AddResult(result);
					
					log.Debug("Suite result = " + suiteResult.ResultState);

                    if (saveRunState != test.RunState)
                    {
                        test.RunState = saveRunState;
                        test.IgnoreReason = null;
                    }

                    if (result.ResultState == ResultState.Cancelled)
                        break;

                    if ((result.IsError || result.IsFailure || result.ResultState == ResultState.NotRunnable) && stopOnError)
                        break;
                }
            }
		}
开发者ID:kobida,项目名称:nunitv2,代码行数:42,代码来源:TestSuite.cs

示例12: Run

		public virtual TestResult Run(EventListener listener, ITestFilter filter, bool tracing, LoggingThreshold logLevel)
		{
            Log.Info("Run - EventListener={0}", listener.GetType().Name);

			// Save active listener for derived classes
			this.listener = listener;

			ITest[] tests = new ITest[runners.Count];
			for( int index = 0; index < runners.Count; index++ )
				tests[index] = ((TestRunner)runners[index]).Test;

            string name = this.testName.Name;
            int count = this.CountTestCases(filter);
            Log.Info("Signalling RunStarted({0},{1})", name, count);
            this.listener.RunStarted(name, count);

			long startTime = DateTime.Now.Ticks;

		    TestResult result = new TestResult(new TestInfo(testName, tests));

            if (this.runInParallel)
            {
                foreach (TestRunner runner in runners)
                    if (filter.Pass(runner.Test))
                        runner.BeginRun(this, filter, tracing, logLevel);

                result = this.EndRun();
            }
            else
            {
                foreach (TestRunner runner in runners)
                    if (filter.Pass(runner.Test))
                        result.AddResult(runner.Run(this, filter, tracing, logLevel));
            }
			
			long stopTime = DateTime.Now.Ticks;
			double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
			result.Time = time;

			this.listener.RunFinished( result );

			this.testResult = result;

			return result;
		}
开发者ID:rmterra,项目名称:AutoTest.Net,代码行数:45,代码来源:AggregatingTestRunner.cs

示例13: CountTestCases

        /// <summary>
        /// Count the test cases that pass a filter. The
        /// result should match those that would execute
        /// when passing the same filter to Run.
        /// </summary>
        /// <param name="filter">The filter to apply</param>
        /// <returns>The count of test cases</returns>
        public int CountTestCases(ITestFilter filter)
        {
            if (filter.IsEmpty)
                return TestCount;

            if (!IsSuite)
                return filter.Pass(this) ? 1 : 0;

            int count = 0;
            if (filter.Pass(this))
            {
                count += Tests.Cast<ITest>().Sum(test => test.CountTestCases(filter));
            }
            return count;
        }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:22,代码来源:TestDataProvider.cs

示例14: Run

		public virtual TestResult Run(EventListener listener, ITestFilter filter )
		{
			// Save active listener for derived classes
			this.listener = listener;

			ITest[] tests = new ITest[runners.Count];
			for( int index = 0; index < runners.Count; index++ )
				tests[index] = ((TestRunner)runners[index]).Test;

			this.listener.RunStarted( this.Test.TestName.Name, this.CountTestCases( filter ) );

			this.listener.SuiteStarted( this.Test.TestName );
			long startTime = DateTime.Now.Ticks;

			TestSuiteResult result = new TestSuiteResult( new TestInfo( testName, tests ), projectName );
			result.RunState = RunState.Executed;
			foreach( TestRunner runner in runners )
				if ( filter.Pass( runner.Test ) )
					result.AddResult( runner.Run( this, filter ) );
			
			long stopTime = DateTime.Now.Ticks;
			double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
			result.Time = time;

			this.listener.SuiteFinished( result );

			this.listener.RunFinished( result );

			this.testResult = result;

			return result;
		}
开发者ID:nobled,项目名称:mono,代码行数:32,代码来源:AggregatingTestRunner.cs

示例15: RunAllTests

        private void RunAllTests(
			TestResult suiteResult, EventListener listener, ITestFilter filter )
        {
            if (Properties.Contains("Timeout"))
                TestContext.TestCaseTimeout = (int)Properties["Timeout"];

            foreach (Test test in ArrayList.Synchronized(Tests))
            {
                if (filter.Pass(test))
                {
                    RunState saveRunState = test.RunState;

                    if (test.RunState == RunState.Runnable && this.RunState != RunState.Runnable && this.RunState != RunState.Explicit )
                    {
                        test.RunState = this.RunState;
                        test.IgnoreReason = this.IgnoreReason;
                    }

                    TestResult result = test.Run(listener, filter);

                    suiteResult.AddResult(result);

                    if (saveRunState != test.RunState)
                    {
                        test.RunState = saveRunState;
                        test.IgnoreReason = null;
                    }

                    if (result.ResultState == ResultState.Cancelled)
                        break;
                }
            }
        }
开发者ID:julianhaslinger,项目名称:shouldly,代码行数:33,代码来源:TestSuite.cs


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