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


C# ITestFilter类代码示例

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


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

示例1: Run

        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            listener.SuiteStarted(this.TestName);

            var suiteListener = new MuteSuiteListener(listener);

            var fixtureResult = base.Run(suiteListener, TestFilter.Empty);
            var testResult = fixtureResult.Results[0] as TestResult;

            if (testResult != null)
            {
                if (testResult.IsFailure || testResult.IsError)
                {
                    fixtureResult.SetResult(testResult.ResultState,
                                            testResult.Message,
                                            testResult.StackTrace);
                }
                if (testResult.IsSuccess)
                {
                    fixtureResult.Success();
                }
            }

            listener.SuiteFinished(fixtureResult);
            return fixtureResult;
        }
开发者ID:concordion,项目名称:concordion.net,代码行数:26,代码来源:ConcordionTestFixture.cs

示例2: Run

        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            var result = new TestResult(this);

            lock (testClosure) {
                try {
                    testClosure.TestMethod();
                    TestNonExceptionCondition(result);
                } catch (IgnoreException iex) {
                    result.Ignore(iex.Message);
                } catch (InconclusiveException icex) {
                    result.Invalid(icex.Message);
                } catch (Exception ex) {
                    TestExceptionCondition(result, ex);
                }

                try {
                    testClosure.TearDown();
                } catch (Exception ex) {
                    result.Failure("Exception in tear-down: "+ex.Message, ex.StackTrace);
                }
            }

            listener.TestFinished(result);
            return result;
        }
开发者ID:i-e-b,项目名称:FluentBdd,代码行数:26,代码来源:ClosureTest.cs

示例3: Run

        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            using (new global::NUnit.Core.TestContext())
            {
                var testResult = new TestResult(this);
                Log.Debug("Test Starting: " + TestName.FullName);
                listener.TestStarted(TestName);
                var stopwatch = new Stopwatch();
                stopwatch.Start();

                switch (RunState)
                {
                    case RunState.Runnable:
                    case RunState.Explicit:
                        DoTest(_test, testResult);
                        break;
                    case RunState.NotRunnable:
                        testResult.Invalid(IgnoreReason);
                        break;
                    case RunState.Ignored:
                        testResult.Ignore(IgnoreReason);
                        break;
                    default:
                        testResult.Skip(IgnoreReason);
                        break;

                }

                stopwatch.Stop();
                testResult.Time = stopwatch.Elapsed.Seconds;

                listener.TestFinished(testResult);
                return testResult;
            }
        }
开发者ID:WalkingDisaster,项目名称:Lingual,代码行数:35,代码来源:LingualTest.cs

示例4: Run

        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            var successCount = 0;
            TestResult failureResult = null;

            for (var i = 0; i < this.tryCount; i++)
            {
                var result = base.Run(listener, filter);

                if (!TestFailed(result))
                {
                    if (i == 0)
                    {
                        return result;
                    }

                    if (++successCount >= this.requiredPassCount)
                    {
                        return result;
                    }
                }
                else
                {
                    failureResult = result;
                }
            }

            return failureResult;
        }
开发者ID:GavinWu,项目名称:NUnit-retry,代码行数:29,代码来源:RetriedTestMethod.cs

示例5: Run

		public override TestResult Run(EventListener listener, ITestFilter filter)
		{
			if (this.Parent != null)
				this.Fixture = this.Parent.Fixture;
			
			return base.Run(listener, filter);
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:RowTestSuite.cs

示例6: CountTestCases

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

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

示例7: Run

		public TestResult Run (EventListener listener, ITestFilter filter, string path, string suiteName, List<string> supportAssemblies, string testRunnerType, string testRunnerAssembly)
		{
			InitSupportAssemblies (supportAssemblies);
			
			if (filter == null)
				filter = TestFilter.Empty;

			TestRunner tr;
			if (!string.IsNullOrEmpty (testRunnerType)) {
				Type runnerType;
				if (string.IsNullOrEmpty (testRunnerAssembly))
					runnerType = Type.GetType (testRunnerType, true);
				else {
					var asm = Assembly.LoadFrom (testRunnerAssembly);
					runnerType = asm.GetType (testRunnerType);
				}
				tr = (TestRunner)Activator.CreateInstance (runnerType);
			} else
				tr = new RemoteTestRunner ();

			TestPackage package = new TestPackage (path);
			if (!string.IsNullOrEmpty (suiteName))
				package.TestName = suiteName;
			tr.Load (package);
			return tr.Run (listener, filter, false, LoggingThreshold.All);
		}
开发者ID:vikingzx9,项目名称:monodevelop,代码行数:26,代码来源:NUnitTestRunner.cs

示例8: Run

        /// <summary>
        /// Override Run, setting Fixture to that of the Parent.
        /// </summary>
        /// <param name="listener"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            if (this.Parent != null)
            {
                this.Fixture = this.Parent.Fixture;
                TestSuite suite = this.Parent as TestSuite;
                if (suite != null)
                {
                    this.setUpMethods = suite.GetSetUpMethods();
                    this.tearDownMethods = suite.GetTearDownMethods();
                }
            }

            // DYNAMIC: Get the parameters, and add the methods here.

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

            if (this.isTheory && result.ResultState == ResultState.Inconclusive)
                result.SetResult(
                    ResultState.Failure,
                    this.TestCount == 0
                        ? "No test cases were provided"
                        : "All test cases were inconclusive",
                    null);

            this.Fixture = null;
            this.setUpMethods = null;
            this.tearDownMethods = null;

            return result;
        }
开发者ID:scottwis,项目名称:eddie,代码行数:37,代码来源:ParameterizedTestMethodSuite.cs

示例9: Run

        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            TestSuiteResult suite_result = new TestSuiteResult (new TestInfo (this), TestName.FullName);

            DebuggerTestHost host = DebuggerTestHost.Create ();
            if (host == null) {
                TestCaseResult error = new TestCaseResult (new TestInfo (this));
                string msg = String.Format ("Failed to create DebuggerTestHost in {0}", FixtureType.Name);
                error.Failure (msg, null, FailureSite.Parent);
                suite_result.AddResult (error);
                return suite_result;
            }

            int timeout;
            if (Attribute.Timeout != 0)
                timeout = Attribute.Timeout;
            else
                timeout = DebuggerTestAddIn.DefaultTimeout;

            int repeat = 1;
            if (Attribute.Repeat != 0)
                repeat = Attribute.Repeat;

            try {
                for (int i = 0; i < repeat; i++) {
                    if (!host.Run (new TestInfo (this), suite_result, Type.AssemblyQualifiedName, listener, filter, timeout))
                        break;
                }

                return suite_result;
            } finally {
                host.Dispose ();
            }
        }
开发者ID:baulig,项目名称:debugger,代码行数:34,代码来源:NUnitAddIn.cs

示例10: Run

 public override TestResult Run(EventListener listener, ITestFilter filter)
 {
     using ( new DirectorySwapper( Path.GetDirectoryName( TestFixtureBuilder.GetAssemblyPath( FixtureType ) ) ) )
     {
         return base.Run(listener, filter);
     }
 }
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:TestFixture.cs

示例11: Run

        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            listener.TestStarted(base.TestName);
            long ticks = DateTime.Now.Ticks;
            TestResult testResult = new TestResult(this);

            Exception existingError = null;

            _globalSetup.PrepareForTestPosition(Position, out existingError);

            if (existingError != null)
            {
                TestResultUtil.Error(testResult, existingError, null, FailureSite.SetUp);
            }
            else
            {
                List<string> traceMessages = null;
                try
                {
                    RunTestMethod(testResult, out traceMessages);
                }
                catch (Exception e)
                {
                    var globalTraceMessages = _globalSetup.GetTraceMessages();
                    TestResultUtil.Error(testResult, e, globalTraceMessages.Concat(traceMessages));
                }
            }

            double num3 = ((double)(DateTime.Now.Ticks - ticks)) / 10000000.0;
            testResult.Time = num3;
            listener.TestFinished(testResult);
            return testResult;
        }
开发者ID:bfriesen,项目名称:DreamNJasmine,代码行数:33,代码来源:NJasmineTestMethod.cs

示例12: Run

		public override TestResult Run(EventListener listener, ITestFilter filter)
		{
			using ( new DirectorySwapper( AssemblyHelper.GetDirectoryName( FixtureType.Assembly ) ) )
			{
				return base.Run(listener, filter);
			}
		}
开发者ID:Phaiax,项目名称:dotnetautoupdate,代码行数:7,代码来源:SetUpFixture.cs

示例13: Run

        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            listener.TestStarted(base.TestName);
            long ticks = DateTime.Now.Ticks;
            var testResult = new TestResultShim();

            Exception existingError = null;

            _globalSetup.PrepareForTestPosition(Position, out existingError);

            if (existingError != null)
            {
                TestResultUtil.Error(testResult, TestExtensions.GetMultilineName(this), existingError, null, TestResultShim.Site.SetUp);
            }
            else
            {
                List<string> traceMessages = null;
                try
                {
                    RunTestMethod(testResult, out traceMessages);
                }
                catch (Exception e)
                {
                    var globalTraceMessages = _globalSetup.GetTraceMessages();
                    TestResultUtil.Error(testResult, TestExtensions.GetMultilineName(this), e, globalTraceMessages.Concat(traceMessages));
                }
            }

            var nunitTestResult = new TestResult(this);
            NativeTestResult.ApplyToNunitResult(testResult, nunitTestResult);
            nunitTestResult.Time = ((DateTime.Now.Ticks - ticks)) / 10000000.0;
            listener.TestFinished(nunitTestResult);
            return nunitTestResult;
        }
开发者ID:idavis,项目名称:DreamNJasmine,代码行数:34,代码来源:NJasmineTestMethod.cs

示例14: Run

        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
        	test.Parent = Parent;

			TestResult result = null;
			for (var i = 1; i < retryCount; i++)
            {
            	try
            	{
            		result = test.Run(listener, filter);
            		if (result.IsFailure || result.IsError)
            		{
            			var message = string.Format("Rerunning '{0}'", TestName);
            			Log.Info(message); Console.WriteLine(message);
            			result = test.Run(listener, filter);
            		}
            	}
				// In Case SetUp or TearDown failed
				catch (Exception e)
            	{
					Log.Info(e.Message); Console.WriteLine(e);
            	}
            }

            return result;
        }
开发者ID:EugeneKha,项目名称:NUnit.Core.Extensibility,代码行数:26,代码来源:RetryTestDecorator.cs

示例15: Run

		public UnitTestResult Run (IRemoteEventListener listener, ITestFilter filter, string path, string suiteName, List<string> supportAssemblies)
		{
			NUnitTestRunner runner = GetRunner (path);
			EventListenerWrapper listenerWrapper = listener != null ? new EventListenerWrapper (listener) : null;
			
			TestResult res = runner.Run (listenerWrapper, filter, path, suiteName, supportAssemblies);
			return listenerWrapper.GetLocalTestResult (res);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:8,代码来源:ExternalTestRunner.cs


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