本文整理汇总了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());
}
示例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());
}
示例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);
}
}
示例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;
}
}
//.........这里部分代码省略.........
示例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());
}