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


C# TestResult.Invalid方法代码示例

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


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

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

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

		private TestResult SkipTest()
		{
			TestResult testResult = new TestResult(this);
			
            switch (this.RunState)
            {
                case RunState.Skipped:
                default:
                    testResult.Skip(IgnoreReason);
                    break;
                case RunState.NotRunnable:
                    if (BuilderException != null)
                        testResult.Invalid(BuilderException);
                    else
                        testResult.Invalid(IgnoreReason);
                    break;
                case RunState.Ignored:
                    testResult.Ignore(IgnoreReason);
                    break;
            }
			
			return testResult;
		}
开发者ID:Buildstarted,项目名称:ContinuousTests,代码行数:23,代码来源:TestMethod.cs

示例4: MarkAllTestsInvalid

 private void MarkAllTestsInvalid(TestResult suiteResult, EventListener listener, ITestFilter filter)
 {
     suiteResult.Invalid(this.IgnoreReason);
     MarkTestsNotRun(this.Tests, ResultState.NotRunnable, this.IgnoreReason, suiteResult, listener, filter);
 }
开发者ID:kobida,项目名称:nunitv2,代码行数:5,代码来源:TestSuite.cs

示例5: DoOneTimeBeforeTestSuiteActions

        protected virtual void DoOneTimeBeforeTestSuiteActions(TestResult suiteResult)
        {
            try
            {
                ExecuteActions(ActionPhase.Before);
                TestExecutionContext.CurrentContext.Update();
            }
            catch (Exception ex)
            {
                if (ex is NUnitException || ex is System.Reflection.TargetInvocationException)
                    ex = ex.InnerException;

                if (ex is InvalidTestFixtureException)
                    suiteResult.Invalid(ex.Message);
                else if (IsIgnoreException(ex))
                {
                    this.RunState = RunState.Ignored;
                    suiteResult.Ignore(ex.Message);
                    suiteResult.StackTrace = ex.StackTrace;
                    this.IgnoreReason = ex.Message;
                }
                else if (IsAssertException(ex))
                    suiteResult.Failure(ex.Message, ex.StackTrace, FailureSite.SetUp);
                else
                    suiteResult.Error(ex, FailureSite.SetUp);
            }
        }
开发者ID:kobida,项目名称:nunitv2,代码行数:27,代码来源:TestSuite.cs

示例6: DoOneTimeSetUp

        protected virtual void DoOneTimeSetUp(TestResult suiteResult)
        {
            if (FixtureType != null)
            {
                try
                {
					// In case TestFixture was created with fixture object
					if (Fixture == null && !IsStaticClass( FixtureType ) )
						CreateUserFixture();

                    if (this.fixtureSetUpMethods != null)
                        foreach( MethodInfo fixtureSetUp in fixtureSetUpMethods )
                            Reflect.InvokeMethod(fixtureSetUp, fixtureSetUp.IsStatic ? null : Fixture);

                    TestExecutionContext.CurrentContext.Update();
                }
                catch (Exception ex)
                {
                    if (ex is NUnitException || ex is System.Reflection.TargetInvocationException)
                        ex = ex.InnerException;

                    if (ex is InvalidTestFixtureException)
                        suiteResult.Invalid(ex.Message);
                    else if (IsIgnoreException(ex))
                    {
                        this.RunState = RunState.Ignored;
                        suiteResult.Ignore(ex.Message);
                        suiteResult.StackTrace = ex.StackTrace;
                        this.IgnoreReason = ex.Message;
                    }
                    else if (IsAssertException(ex))
                        suiteResult.Failure(ex.Message, ex.StackTrace, FailureSite.SetUp);
                    else
                        suiteResult.Error(ex, FailureSite.SetUp);
                }
            }
        }
开发者ID:kobida,项目名称:nunitv2,代码行数:37,代码来源:TestSuite.cs

示例7: Run

        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            using (new TestContext())
            {
                TestResult testResult = new TestResult(this);

                log.Debug("Test Starting: " + this.TestName.FullName);
                listener.TestStarted(this.TestName);
                long startTime = DateTime.Now.Ticks;

                switch (this.RunState)
                {
                    case RunState.Runnable:
                    case RunState.Explicit:
                        Run(testResult);
                        break;
                    case RunState.Skipped:
                    default:
                        testResult.Skip(IgnoreReason);
                        break;
                    case RunState.NotRunnable:
                        if (BuilderException != null)
                            testResult.Invalid(BuilderException);
                        else
                            testResult.Invalid(IgnoreReason);
                        break;
                    case RunState.Ignored:
                        testResult.Ignore(IgnoreReason);
                        break;
                }

                long stopTime = DateTime.Now.Ticks;
                double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
                testResult.Time = time;

                listener.TestFinished(testResult);
                return testResult;
            }
        }
开发者ID:Phaiax,项目名称:dotnetautoupdate,代码行数:39,代码来源:TestMethod.cs

示例8: DoOneTimeSetUp

		/// <summary>
		/// Performs a one-time set-up for this test suite.
		/// </summary>
		/// <remarks>
		/// The implementation calls the base method and then calls all methods decorated
		/// with NUnit's Test Fixture Set Up Attribute that accept a single argument parameter.
		/// </remarks>
		/// <param name="suiteResult">The result of the test.</param>
		protected override void DoOneTimeSetUp(TestResult suiteResult)
		{
			base.DoOneTimeSetUp(suiteResult);
			try
			{
				if (Argument != null)
				{
					foreach (MethodInfo setupMethod in Reflect.GetMethodsWithAttribute(FixtureType, NUnitFramework.FixtureSetUpAttribute, true))
					{
						if (setupMethod.GetParameters().Length == 1)
						{
							Reflect.InvokeMethod(setupMethod, this.Fixture, Argument);
						}
					}
				}
			}
			catch (Exception innerException)
			{
				if (innerException is NUnitException || innerException is TargetInvocationException)
				{
					innerException = innerException.InnerException;
				}

				if (innerException is InvalidTestFixtureException)
				{
					suiteResult.Invalid(innerException.Message);
				}
				else
				{
					if (this.IsIgnoreException(innerException))
					{
						base.RunState = RunState.Ignored;
						suiteResult.Ignore(innerException.Message);
						suiteResult.StackTrace = innerException.StackTrace;
						base.IgnoreReason = innerException.Message;
					}
					else
					{
						if (this.IsAssertException(innerException))
						{
							suiteResult.Failure(innerException.Message, innerException.StackTrace, FailureSite.SetUp);
						}
						else
						{
							suiteResult.Error(innerException, FailureSite.SetUp);
						}
					}
				}
			}
		}
开发者ID:ngeor,项目名称:NUnitCompanion,代码行数:58,代码来源:MultiTestFixture.cs


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