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


C# TestResult.Success方法代码示例

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


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

示例1: Merge

        /// <summary>
        /// Merges the specified other.
        /// </summary>
        /// <param name="source"> </param>
        /// <param name="target"> </param>
        public void Merge(TestResult source, TestResult target)
        {
            var mergedType = GetType(target);
            var otherType = GetType(source);

            if (mergedType == TestType.Project && otherType == TestType.Project)
            {
                if (string.IsNullOrEmpty(target.FullName) && !string.IsNullOrEmpty(source.FullName))
                {
                    target.Test.TestName.FullName = source.FullName;
                    target.Test.TestName.Name = source.Name;
                }
            }

            if (mergedType != otherType)
                throw new NotSupportedException("Only merging of results with same test type are supported");

            if (!target.IsSuccess && source.IsSuccess)
            {
                target.Success(source.Message);
                target.SetAgentName(source.GetAgentName());
            }

            MergeChildren(source, target);
        }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:30,代码来源:TestResultsProcessor.cs

示例2: CreateTestResultFromExpectation

        TestResult CreateTestResultFromExpectation(IExpectation expectation)
        {
            var result = new TestResult(new TestName { Name = expectation.Message });

            if (expectation.IsFail)
                result.Failure(expectation.ToString(), "");
            else if (expectation.IsPass)
                result.Success();
            else if (expectation.IsPending)
                result.Ignore(expectation.ToString(), "");

            return result;
        }
开发者ID:nspec,项目名称:NSpec,代码行数:13,代码来源:TestResultExampleReporter.cs

示例3: RunTestMethod

        public override void RunTestMethod(TestResult testResult)
        {
            using (var runner = new Runner(Spec))
            {
                var example = runner.Run(() => RunBaseTestMethod(testResult), new TestResultExampleReporter(testResult));

                if (example.IsFail)
                    testResult.Failure(GetTestResultMessageForResultState(testResult, ResultState.Failure, "Failing"), "");

                if (example.IsPass)
                    testResult.Success();

                if (example.IsPending)
                    testResult.Ignore(GetTestResultMessageForResultState(testResult, ResultState.Ignored, "Pending"));
            }
        }
开发者ID:AnthonyEgerton,项目名称:NSpec,代码行数:16,代码来源:NSpecTestMethod.cs

示例4: DoTest

 private static void DoTest(Action test, TestResult testResult)
 {
     try
     {
         test();
         testResult.Success();
     }
     catch(ThreadAbortException e)
     {
         Thread.ResetAbort();
         HandleException(e, testResult);
     }
     catch (Exception e)
     {
         HandleException(e, testResult);
     }
 }
开发者ID:WalkingDisaster,项目名称:Lingual,代码行数:17,代码来源:LingualTest.cs

示例5: CreateTestResult

        public TestResult CreateTestResult(TestType type, string fullName,
                                           ResultState state = ResultState.Success, 
                                           Func<IEnumerable<TestResult>> children = null, 
                                           string stackTrace = null, 
                                           string description = null,
                                           IList categories = null,
                                           string agentName = null)
        {
            description = description ?? RandomValuesGenerator.GetRandomValue<string>();
            agentName = agentName ?? RandomValuesGenerator.GetRandomValue<string>();
            var splitted = (fullName ?? string.Empty).Split(new[]{'.'}, StringSplitOptions.RemoveEmptyEntries);

            var childResults = children != null ? children() : new TestResult[0];
            var testResult = new TestResult(new TestInfoWrapper
                                                {
                                                    TestName = new TestName
                                                                   {
                                                                       FullName = fullName,
                                                                       Name = splitted.Length > 0 ? splitted[splitted.Length - 1] : string.Empty
                                                                   },
                                                    Categories = categories,
                                                    IsSuite = type != TestType.TestMethod,
                                                    TestCount = type == TestType.TestMethod ? 1 : RandomValuesGenerator.GetRandomValue<int>(),
                                                    TestType = type.ToString()
                                                })
                                 {
                                     AssertCount = 1,
                                     Time = RandomValuesGenerator.GetRandomValue<double>()
                                 };
            if (state != ResultState.Success)
                testResult.SetResult(state,
                                     description,
                                     stackTrace);
            else
                testResult.Success(description);

            testResult.SetAgentName(agentName);

            foreach (var childResult in childResults)
            {
                testResult.AddResult(childResult);
            }

            return testResult;
        }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:45,代码来源:TestEntitiesGenerator.cs

示例6: ApplyToNunitResult

        public static TestResult ApplyToNunitResult(TestResultShim shim, TestResult result)
        {
            switch (shim.Status)
            {
                case TestResultShim.Result.Successs:
                    result.Success();
                    break;
                case TestResultShim.Result.Error:
                    result.SetResult(ResultState.Error, shim.FailureReason, shim.FailureStackTrace, GetNUnitFailureSite(shim.FailureSite));
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            result.Time = shim.ExecutionTime.Seconds;

            return result;
        }
开发者ID:edwardt,项目名称:DreamNJasmine,代码行数:18,代码来源:NativeTestResult.cs

示例7: NUnitTestResult

        private TestResult NUnitTestResult(IResultSummary concordionResult)
        {
            var testResult = new TestResult(this);

            if (concordionResult.HasExceptions)
            {
                testResult.Error(new NUnitException("Exception in Concordion test: please see Concordion test reports"));
            }
            else if (concordionResult.HasFailures)
            {
                testResult.Failure("Concordion Test Failures: " + concordionResult.FailureCount,
                                   "for stack trace, please see Concordion test reports");
            } else
            {
                testResult.Success();
            }

            return testResult;
        }
开发者ID:john-ross,项目名称:concordion-net,代码行数:19,代码来源:ConcordionTest.cs

示例8: Run

        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            // TODO: Implement logic required for filtering.

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

            var result = new TestResult(this);

            try
            {
                _engine.ExecuteScriptFile(_scriptPath);
                result.Success();
            }
            catch (AssertionException assertEx)
            {
                result.SetResult(ResultState.Failure, assertEx.Message, assertEx.StackTrace, FailureSite.Test);
            }
            catch (InconclusiveException inconclusiveEx)
            {
                result.SetResult(ResultState.Inconclusive, inconclusiveEx.Message, inconclusiveEx.StackTrace);
            }
            catch (Exception ex)
            {
                result.Error(ex);
            }
            finally
            {
                long stopTime = DateTime.Now.Ticks;
                double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
                result.Time = time;

                listener.TestFinished(result);
            }

            return result;
        }
开发者ID:rablewis,项目名称:NuScript,代码行数:37,代码来源:ScriptTest.cs

示例9: RunTestMethod

		private void RunTestMethod(TestResult testResult)
		{
		    object fixture = this.method.IsStatic ? null : this.Fixture;

			object result = Reflect.InvokeMethod( this.method, fixture, this.arguments );

            if (this.hasExpectedResult)
                NUnitFramework.Assert.AreEqual(expectedResult, result);

            testResult.Success();
        }
开发者ID:Buildstarted,项目名称:ContinuousTests,代码行数:11,代码来源:TestMethod.cs

示例10: NUnitTestResult

        private TestResult NUnitTestResult(ResultSummary concordionResult, string resultPath)
        {
            var testResult = new TestResult(this);

            if (concordionResult.hasExceptions())
            {
                testResult.Error(new NUnitException("Exception in Concordion test: please see Concordion test reports"));
            }
            else if (concordionResult.getFailureCount() > 0)
            {
                testResult.Failure("Concordion Test Failures: " + concordionResult.getFailureCount(),
                                   "for stack trace, please see Concordion test reports");
            } else
            {
                testResult.Success(resultPath);
            }

            return testResult;
        }
开发者ID:concordion,项目名称:concordion.net,代码行数:19,代码来源:ConcordionTest.cs

示例11: RunTestCase

		private void RunTestCase( TestResult testResult )
		{
            try
            {
                object result = RunTestMethod(testResult);

                if (this.hasExpectedResult)
                    NUnitFramework.Assert.AreEqual(expectedResult, result);

                testResult.Success();

                if (testResult.IsSuccess && exceptionProcessor != null)
                    exceptionProcessor.ProcessNoException(testResult);
            }
            catch (Exception ex)
            {
                if (ex is ThreadAbortException)
                    Thread.ResetAbort();

                if (exceptionProcessor == null)
                    RecordException(ex, testResult, FailureSite.Test);
                else
                    exceptionProcessor.ProcessException(ex, testResult);
            }
		}
开发者ID:EndScene,项目名称:serverOne,代码行数:25,代码来源:TestMethod.cs

示例12: RunTest

		public override TestResult RunTest ()
		{
			var result = new TestResult (TestName);
			var module = GetModule ();
			if (module == null)
				return result;

			Reflect.InvokeMethod (Method, Fixture, new object [] { module });

			result.Success ();
			return result;
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:12,代码来源:Addin.cs

示例13: SetResult_Success

		public void SetResult_Success()
		{
			TestSuiteTreeNode node = new TestSuiteTreeNode( testCaseInfo );
			TestResult result = new TestResult( testCaseInfo );

			result.Success();
			node.Result = result;
			Assert.AreEqual( TestSuiteTreeNode.SuccessIndex, node.ImageIndex );
			Assert.AreEqual( TestSuiteTreeNode.SuccessIndex, node.SelectedImageIndex );
			Assert.AreEqual( "Success", node.StatusText );
		}
开发者ID:Vernathic,项目名称:ic-AutoTest.NET4CTDD,代码行数:11,代码来源:TestSuiteTreeNodeTests.cs

示例14: doTestCase

        private void doTestCase(TestResult testResult)
        {
            object fixture = this.Method.IsStatic ? null : this.Fixture;

            // Ugh... RunTestMethod is publicly overridable, but depends on a whole bunch of internal/private detail, so it's not really very overridable...
            var arguments = Helper.ReadPrivateField<object[]>(this, "arguments");
            var hasExpectedResult = Helper.ReadPrivateField<bool>(this, "hasExpectedResult");
            var expectedResult = Helper.ReadPrivateField<object>(this, "expectedResult");

            object result = Helper.InvokeMethodDirect(this.Method, fixture, arguments);

            if (hasExpectedResult)
                NUnitFramework.Assert.AreEqual(expectedResult, result);

            testResult.Success();
        }
开发者ID:RT-Projects,项目名称:RT.NUnitDirect,代码行数:16,代码来源:Direct.cs

示例15: TestNonExceptionCondition

 private void TestNonExceptionCondition(TestResult result)
 {
     if (! TestShouldThrowException()) result.Success();
     else result.Failure("The behaviour did not throw an exception", "");
 }
开发者ID:i-e-b,项目名称:FluentBdd,代码行数:5,代码来源:ClosureTest.cs


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