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


C# LogMessage.ToString方法代码示例

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


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

示例1: Process

        /// <summary>
        /// Display a LogMessage in the debug output window.
        /// </summary>
        /// <param name="logMessage">Message object.</param>
        public override void Process(LogMessage logMessage)
        {
            if (logMessage == null)
            {
                throw new ArgumentNullException("logMessage");
            }

            if ((logMessage.MessageType != LogMessageType.Debug) && !ShowEverything)
            {
                if (!ShowAllFailures)
                {
                    return;
                }
                
                if (logMessage.HasDecorator(LogDecorator.TestOutcome))
                {
                    TestOutcome outcome = (TestOutcome)logMessage[LogDecorator.TestOutcome];
                    if (outcome == TestOutcome.Passed)
                    {
                        return;
                    }
                }
            }

            // Skip Finishing messages, they're always duplicates
            if (logMessage.HasDecorator(LogDecorator.TestStage))
            {
                if ((TestStage)logMessage[LogDecorator.TestStage] == TestStage.Finishing)
                {
                    return;
                }
            }

            Debug.WriteLine(logMessage.ToString());
        }
开发者ID:modulexcite,项目名称:SilverlightToolkit,代码行数:39,代码来源:DebugOutputProvider.cs

示例2: ProcessIncorrectException

 /// <summary>
 /// Process an Exception that was not the expected Exception type.
 /// </summary>
 /// <param name="l">The log message.</param>
 private void ProcessIncorrectException(LogMessage l)
 {
     _writer.AddPendingErrorMessage(l.ToString());
 }
开发者ID:modulexcite,项目名称:SilverlightToolkit,代码行数:8,代码来源:VisualStudioLogProvider.cs

示例3: ProcessGranularEvent

        /// <summary>
        /// Process an event with granular properties.
        /// </summary>
        /// <param name="l">The log message object.</param>
        private void ProcessGranularEvent(LogMessage l)
        {
            TestGranularity granularity = (TestGranularity)l[LogDecorator.TestGranularity];
            HtmlDiv div = new HtmlDiv();
            div.InnerHtml = l.Message;
            div.Padding.All = 2;

            switch (granularity)
            {
                case TestGranularity.Harness:
                    div.BackgroundColor = Color.DarkGray;
                    div.ForegroundColor = Color.VeryLightGray;
                    break;

                case TestGranularity.TestScenario:
                case TestGranularity.Test:
                    break;

                case TestGranularity.TestGroup:
                    div.Font.Bold = true;
                    break;

                default:
                    div = null;
                    AppendFixedText(l.ToString());
                    break;
            }
            if (div != null)
            {
                _myLog.Controls.Add(div);
            }
        }
开发者ID:dfr0,项目名称:moon,代码行数:36,代码来源:WebpageLogProvider.cs

示例4: ProcessMessage

		private void ProcessMessage (LogMessage logMessage) {
			TestMethod m;
			TestOutcome outcome;
			TestGranularity granularity;
			TestStage stage;
			ScenarioResult result;

			if (filename == null)
				return;

			Debug.WriteLine (logMessage);

			try {
				switch (logMessage.MessageType) {
				case LogMessageType.Error:
					// Ignore this
					break;
				case LogMessageType.KnownIssue:
					known_issue = true;
					break;
				case LogMessageType.TestResult:
					result = (ScenarioResult) logMessage.Decorators [UnitTestLogDecorator.ScenarioResult];
					outcome = result.Result;

					if (known_issue) {
						writer.WriteAttributeString ("Result", "KnownIssue");
						totals [KnownIssueIndex]++;
					} else {
						writer.WriteAttributeString ("Result", outcome.ToString ());
						totals [(int) outcome]++;
					}
					known_issue = false;
					writer.WriteAttributeString ("StartTime", result.Started.ToUniversalTime ().ToString ("yyyy/MM/dd HH:mm:ss.fffffff"));
					writer.WriteAttributeString ("EndTime", result.Finished.ToUniversalTime ().ToString ("yyyy/MM/dd HH:mm:ss.fffffff"));
					if (result.Exception != null) {
						writer.WriteAttributeString ("Message", result.Exception.Message);
						writer.WriteStartElement ("Exception");
						writer.WriteAttributeString ("Type", result.Exception.GetType ().FullName);
						writer.WriteAttributeString ("Message", result.Exception.Message);
						writer.WriteElementString ("StackTrace", result.Exception.StackTrace);
						writer.WriteEndElement ();
					}
					break;
				case LogMessageType.TestExecution:
					known_issue = false;
					granularity = (TestGranularity) logMessage.Decorators [LogDecorator.TestGranularity];

					switch (granularity) {
					case TestGranularity.TestGroup:
						stage = (TestStage) logMessage.Decorators [LogDecorator.TestStage];
						switch (stage) {
						case TestStage.Starting:
							writer.WriteStartElement ("MoonLog");
							break;
						case TestStage.Finishing:
						case TestStage.Canceling:

							writer.WriteStartElement ("Totals");
							for (int i = 0; i < totals.Length; i++) {
								if (i == KnownIssueIndex) {
									writer.WriteAttributeString ("KnownIssue", totals [i].ToString ());
								} else {
									writer.WriteAttributeString (((TestOutcome) i).ToString (), totals [i].ToString ());
								}									
							}
							writer.WriteEndElement ();

							writer.WriteEndElement ();
							break;
						case TestStage.Running:
							break;
						}
						break;
					case TestGranularity.TestScenario:
						if (logMessage.Decorators.HasDecorator (UnitTestLogDecorator.IgnoreMessage) && (bool) logMessage.Decorators [UnitTestLogDecorator.IgnoreMessage]) {
							m = (TestMethod) logMessage.Decorators [UnitTestLogDecorator.TestMethodMetadata];
							writer.WriteStartElement ("Test");
							writer.WriteAttributeString ("Class", m.Method.DeclaringType.FullName);
							writer.WriteAttributeString ("Name", m.Method.Name);
							writer.WriteAttributeString ("FullName", m.Method.DeclaringType.FullName + "." + m.Method.Name);
							writer.WriteAttributeString ("Result", "NotExecuted");
							writer.WriteAttributeString ("Ignored", "True");
							writer.WriteEndElement ();
							totals [(int) TestOutcome.NotExecuted]++;
						} else {
							stage = (TestStage) logMessage.Decorators [LogDecorator.TestStage];
							switch (stage) {
							case TestStage.Starting:
								m = (TestMethod) logMessage.Decorators [UnitTestLogDecorator.TestMethodMetadata];
								writer.WriteStartElement ("Test");
								writer.WriteAttributeString ("Class", m.Method.DeclaringType.FullName);
								writer.WriteAttributeString ("Name", m.Method.Name);
								writer.WriteAttributeString ("FullName", m.Method.DeclaringType.FullName + "." + m.Method.Name);
								break;
							case TestStage.Finishing:
							case TestStage.Canceling:
								writer.WriteEndElement ();
								break;
							}
						}
//.........这里部分代码省略.........
开发者ID:dfr0,项目名称:moon,代码行数:101,代码来源:MoonLogProvider.cs

示例5: ProcessRemainder

 /// <summary>
 /// How to process any remaining messages.
 /// </summary>
 /// <param name="message">The log message.</param>
 protected override void ProcessRemainder(LogMessage message)
 {
     AppendFixedText(message.ToString());
 }
开发者ID:dfr0,项目名称:moon,代码行数:8,代码来源:WebpageLogProvider.cs


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