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


C# NUnit.UnitTestResult类代码示例

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


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

示例1: CreateIgnored

		public static UnitTestResult CreateIgnored (string message)
		{
			UnitTestResult res = new UnitTestResult ();
			res.status = ResultStatus.Ignored;
			res.Message = message;
			return res;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:UnitTestResult.cs

示例2: RegisterResult

		public void RegisterResult (string configuration, UnitTest test, UnitTestResult result)
		{
			string aname = test.StoreRelativeName;
			
			TestRecord root = GetRootRecord (configuration, result.TestDate);
			if (root == null) {
				root = new TestRecord ();
				fileCache [GetRootFileName (configuration, result.TestDate)] = root;
			}
			root.Modified = true;
			TestRecord record = root;
			
			if (aname.Length > 0) {
				string[] path = test.StoreRelativeName.Split ('.');
				foreach (string p in path) {
					TestRecord ctr = record.Tests != null ? record.Tests [p] : null;
					if (ctr == null) {
						ctr = new TestRecord ();
						ctr.Name = p;
						if (record.Tests == null)
							record.Tests = new TestRecordCollection ();
						record.Tests.Add (ctr);
					}
					record = ctr;
				}
			}
			
			if (record.Results == null)
				record.Results = new UnitTestResultCollection ();
			record.Results.Add (result);
		}
开发者ID:hippiehunter,项目名称:monodevelop,代码行数:31,代码来源:AbstractResultsStore.cs

示例3: XUnitExecutionSession

		public XUnitExecutionSession (UnitTest unitTest, bool reportToMonitor)
		{
			this.reportToMonitor = reportToMonitor;
			this.unitTest = unitTest;
			result = new UnitTestResult ();
			childSessions = new List<XUnitExecutionSession> ();
		}
开发者ID:lextm,项目名称:xamarinstudio.xunit,代码行数:7,代码来源:XUnitExecutionSession.cs

示例4: CreateInconclusive

		public static UnitTestResult CreateInconclusive (string message)
		{
			UnitTestResult res = new UnitTestResult ();
			res.status = ResultStatus.Inconclusive;
			res.Message = message;
			return res;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:UnitTestResult.cs

示例5: CreateFailure

		public static UnitTestResult CreateFailure (string message, Exception ex)
		{
			UnitTestResult res = new UnitTestResult ();
			res.status = ResultStatus.Failure;
			res.Message = message;
			res.stackTrace = ex.Message + "\n" + ex.StackTrace;
			return res;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:8,代码来源:UnitTestResult.cs

示例6: ResultRecord

        void ITestProgressMonitor.EndTest(UnitTest test, UnitTestResult result)
        {
            if (test is UnitTestGroup)
                return;

            testsRun++;
            ResultRecord rec = new ResultRecord ();
            rec.Test = test;
            rec.Result = result;

            if (result.IsFailure) {
                testsFailed++;
            }
            if (result.IsIgnored) {
                testsIgnored++;
            }
            results.Add (rec);

            ShowTestResult (test, result);

            UpdateCounters ();
            progressBar.Fraction = ((double)testsRun / (double)testsToRun);
            progressBar.Text = testsRun + " / " + testsToRun;
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:24,代码来源:TestResultsPad.cs

示例7: EndTest

		public void EndTest (UnitTest test, UnitTestResult result)
		{
			Runtime.RunInMainThread (delegate {
				monitor.EndTest (test, result);
			});
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:6,代码来源:TestResultsPad.cs

示例8: CountResults

		int CountResults (UnitTestResult result)
		{
			int count = 0;
			count += result.Passed;
			count += result.Errors;
			count += result.Failures;
			count += result.Ignored;
			count += result.Inconclusive;
			count += result.Skipped;
			return count;
		}
开发者ID:lextm,项目名称:xamarinstudio.xunit,代码行数:11,代码来源:XUnitTestCase.cs

示例9: Add

		public void Add (UnitTestResult test)
		{
			((IList)this).Add (test);
		}
开发者ID:hippiehunter,项目名称:monodevelop,代码行数:4,代码来源:AbstractResultsStore.cs

示例10: ReportXmlResult

		UnitTestResult ReportXmlResult (IRemoteEventListener listener, XElement elem, string testPrefix, bool macunitStyle)
		{
			UnitTestResult result = new UnitTestResult ();
			var time = (string)elem.Attribute ("time");
			if (time != null)
				result.Time = TimeSpan.FromSeconds (double.Parse (time, CultureInfo.InvariantCulture));
			result.TestDate = DateTime.Now;

			var reason = elem.Element ("reason");
			if (reason != null)
				result.Message = (string) reason;

			var failure = elem.Element ("failure");
			if (failure != null) {
				var msg = failure.Element ("message");
				if (msg != null)
					result.Message = (string)msg;
				var stack = failure.Element ("stack-trace");
				if (stack != null)
					result.StackTrace = (string)stack;
			}

			switch ((string)elem.Attribute ("result")) {
			case "Error":
			case "Failure":
				result.Status = ResultStatus.Failure;
				break;
			case "Success":
				result.Status = ResultStatus.Success;
				break;
			case "Ignored":
				result.Status = ResultStatus.Ignored;
				break;
			default:
				result.Status = ResultStatus.Inconclusive;
				break;
			}

			if (elem.Name == "test-suite") {
				// nunitlite does not emit <test-suite type="Namespace" elements so we need to fake
				// them by deconstructing the full type name and emitting the suite started events manually
				var names = new List<string> ();
				if (!macunitStyle || (string)elem.Attribute ("type") == "Assembly")
					names.Add ("<root>");
				else
					names.AddRange (elem.Attribute ("name").Value.Split ('.'));

				for (int i = 0; i < names.Count; i ++)
					listener.SuiteStarted (testPrefix + string.Join (".", names.Take (i + 1)));

				var name = (string)elem.Attribute ("type") == "Assembly" ? "<root>" : (string) elem.Attribute ("name");
				var cts = elem.Element ("results");
				if (cts != null) {
					foreach (var ct in cts.Elements ()) {
						var r = ReportXmlResult (listener, ct, name != "<root>" ? testPrefix + name + "." : "", macunitStyle);
						result.Add (r);
					}
				}
				for (int i = 0; i < names.Count; i ++)
					listener.SuiteFinished (testPrefix + string.Join (".", names.Take (i + 1)), result);
			} else {
				string name = (string)elem.Attribute ("name");
				switch (result.Status) {
				case ResultStatus.Success:
					result.Passed++;
					break;
				case ResultStatus.Failure:
					result.Failures++;
					break;
				case ResultStatus.Ignored:
					result.Ignored++;
					break;
				case ResultStatus.Inconclusive:
					result.Inconclusive++;
					break;
				}

				listener.TestStarted (name);
				listener.TestFinished (name, result);
			}
			return result;
		}
开发者ID:riverans,项目名称:monodevelop,代码行数:82,代码来源:NUnitAssemblyTestSuite.cs

示例11: EndTest

		public void EndTest (UnitTest test, UnitTestResult result)
		{
			DispatchService.GuiDispatch (delegate {
				monitor.EndTest (test, result);
			});
		}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:6,代码来源:TestResultsPad.cs

示例12: OnFailed

		public void OnFailed (TestContext context, string id, decimal executionTime, string output, string[] exceptionTypes, string[] messages, string[] stackTraces)
		{
			UnitTestResult result = session.Result;
			VirtualTest test = null;

			int count = CountResults (session.Result);

			if (count > 0) {
				if (count < 2) {
					test = new VirtualTest (this, count);
					result = CopyResult (session.Result);

					session.Context.Monitor.BeginTest (test);
					session.Context.Monitor.EndTest (test, result);
					test.RegisterResult (session.Context, result);

					session.Result.Add (result);
					count++;
				}

				test = new VirtualTest (this, count);
				result = new UnitTestResult ();
			}

			result.Status = ResultStatus.Failure;
			result.Failures = 1;

			result.Time = TimeSpan.FromSeconds (Decimal.ToDouble (executionTime));
			result.ConsoleOutput = output;

			if (messages.Length > 0)
				result.Message = messages [0];

			if (stackTraces.Length > 0)
				result.StackTrace = stackTraces [0];

			if (test != null) {
				session.Context.Monitor.BeginTest (test);
				session.Context.Monitor.EndTest (test, result);
				test.RegisterResult (session.Context, result);

				session.Result.Add (result);
			}
		}
开发者ID:lextm,项目名称:xamarinstudio.xunit,代码行数:44,代码来源:XUnitTestCase.cs

示例13: OnTestSuiteChanged

		public void OnTestSuiteChanged (object sender, EventArgs e)
		{
			if (failuresTreeView.IsRealized)
				failuresTreeView.ScrollToPoint (0, 0);

			results.Clear ();
			
			error = null;
			errorMessage = null;
			
			failuresStore.Clear ();
			outputView.Buffer.Clear ();
			outIters.Clear ();
			progressBar.Fraction = 0;
			progressBar.Text = "";
			testsRun = 0;
			resultSummary = new UnitTestResult ();
			UpdateCounters ();
			if (rootTest != null) {
				rootTest = testService.SearchTest (rootTest.FullName);
				if (rootTest == null)
					buttonRun.Sensitive = false;
			}
		}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:24,代码来源:TestResultsPad.cs

示例14: Add

		public void Add (UnitTestResult res)
		{
			Time += res.Time;
			Passed += res.Passed;
			Errors += res.Errors;
			Failures += res.Failures;
			Ignored += res.Ignored;
			Inconclusive += res.Inconclusive;
			Skipped += res.Skipped;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:10,代码来源:UnitTestResult.cs

示例15: OnRun

		protected override UnitTestResult OnRun (TestContext testContext)
		{
			UnitTestResult tres = new UnitTestResult ();
			OnBeginTest (testContext);
			
			try {
				foreach (UnitTest t in Tests) {
					if (t.IsExplicit)
						continue;
					UnitTestResult res;
					try {
						res = OnRunChildTest (t, testContext);
						if (testContext.Monitor.IsCancelRequested)
							break;
					} catch (Exception ex) {
						res = UnitTestResult.CreateFailure (ex);
					}
					tres.Add (res);
				}
			} finally {
				OnEndTest (testContext);
			}
			return tres;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:24,代码来源:UnitTestGroup.cs


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