本文整理汇总了C#中Microsoft.Silverlight.Testing.Harness.LogMessage.HasDecorator方法的典型用法代码示例。如果您正苦于以下问题:C# LogMessage.HasDecorator方法的具体用法?C# LogMessage.HasDecorator怎么用?C# LogMessage.HasDecorator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Silverlight.Testing.Harness.LogMessage
的用法示例。
在下文中一共展示了LogMessage.HasDecorator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: HasUnitTestOutcome
/// <summary>
/// Determines whether a log message meets a specific condition or set
/// of conditions.
/// </summary>
/// <param name="message">The log message object.</param>
/// <returns>Returns true if the condition is met.</returns>
public static bool HasUnitTestOutcome(LogMessage message)
{
if (!IsUnitTestMessage(message))
{
return false;
}
return message.HasDecorator(LogDecorator.TestOutcome);
}
示例3: IsIncorrectExceptionLogMessage
/// <summary>
/// Determines whether a log message meets a specific condition or set
/// of conditions.
/// </summary>
/// <param name="message">The log message object.</param>
/// <returns>Returns true if the condition is met.</returns>
public static bool IsIncorrectExceptionLogMessage(LogMessage message)
{
if (!IsUnitTestMessage(message))
{
return false;
}
return message.HasDecorator(UnitTestLogDecorator.IncorrectExceptionMessage);
}
示例4: IsExceptionLogMessage
/// <summary>
/// Determines whether a log message meets a specific condition or set
/// of conditions.
/// </summary>
/// <param name="message">The log message object.</param>
/// <returns>Returns true if the condition is met.</returns>
public static bool IsExceptionLogMessage(LogMessage message)
{
if (!IsUnitTestMessage(message))
{
return false;
}
return message.HasDecorator(UnitTestLogDecorator.ActualException);
}
示例5: Process
public override void Process(LogMessage logMessage) {
if(isFirstMessage) {
isFirstMessage = false;
ProcessStartMessage();
} else
if(logMessage.HasDecorator(LogDecorator.TestOutcome))
ProcessResultMessage(logMessage);
}
示例6: ProcessResult
/// <summary>
/// Process a UTF result message.
/// </summary>
/// <param name="logMessage">The log message object.</param>
private void ProcessResult(LogMessage logMessage)
{
if (logMessage.HasDecorator(UnitTestLogDecorator.TestMethodMetadata))
{
ScenarioResult sr = (ScenarioResult)logMessage[UnitTestLogDecorator.ScenarioResult];
if (sr.Result != TestOutcome.Passed)
{
_failures.Add(sr);
}
}
}
示例7: Process
public override void Process(LogMessage logMessage)
{
if (logMessage.HasDecorator(LogDecorator.TestStage))
{
var stage = (TestStage)logMessage[LogDecorator.TestStage];
if (stage == TestStage.Starting)
{
if (logMessage.HasDecorator(UnitTestLogDecorator.TestMethodMetadata))
{
var methodInfo = (TestMethod)logMessage[UnitTestLogDecorator.TestMethodMetadata];
var wc = new WebClient();
wc.UploadStringAsync(new Uri(baseUrl, "/TestMethodStarting?method=" + methodInfo.Name), "");
}
else if (logMessage.HasDecorator(UnitTestLogDecorator.TestClassMetadata))
{
var classInfo = (TestClass)logMessage[UnitTestLogDecorator.TestClassMetadata];
var wc = new WebClient();
wc.UploadStringAsync(new Uri(baseUrl, "/TestClassStarting?class=" + classInfo.Type.FullName), "");
}
}
}
if (logMessage.HasDecorator(UnitTestLogDecorator.ScenarioResult))
{
var result = (ScenarioResult)logMessage[UnitTestLogDecorator.ScenarioResult];
var wc = new WebClient();
StringBuilder uri = new StringBuilder();
uri.Append("/TestMethodCompleted?result=" + result.Result);
if (result.TestClass != null)
{
uri.Append("&class=").Append(result.TestClass.Type.FullName);
}
if (result.TestMethod != null)
{
uri.Append("&method=").Append(result.TestMethod.Name);
}
wc.UploadStringAsync(new Uri(baseUrl, uri.ToString()), "");
}
}
示例8: Process
public override void Process(LogMessage logMessage)
{
if (logMessage.HasDecorator(UnitTestLogDecorator.ScenarioResult))
{
var result = (ScenarioResult)logMessage[UnitTestLogDecorator.ScenarioResult];
InvokeDomMethod("scenarioResult",
result.Started.Ticks,
result.Finished.Ticks,
(result.TestClass != null) ? result.TestClass.Type.FullName : null,
(result.TestMethod != null) ? result.TestMethod.Name : null,
result.Result.ToString(),
(result.Exception != null) ? result.Exception.ToString() : null);
}
}
示例9: IsUnitTestEndMessage
/// <summary>
/// Determines whether a log message meets a specific condition or set
/// of conditions.
/// </summary>
/// <param name="message">The log message object.</param>
/// <returns>Returns true if the condition is met.</returns>
public static bool IsUnitTestEndMessage(LogMessage message)
{
if (!IsUnitTestMessage(message))
{
return false;
}
if (message.HasDecorator(LogDecorator.TestStage))
{
TestStage ts = (TestStage)message[LogDecorator.TestStage];
return ts == TestStage.Finishing;
}
else
{
return false;
}
}
示例10: ProcessResult
/// <summary>
/// Process a UTF result message.
/// </summary>
/// <param name="logMessage">The log message object.</param>
private void ProcessResult(LogMessage logMessage)
{
if (logMessage.HasDecorator(UnitTestLogDecorator.TestMethodMetadata))
{
TestOutcome result = (TestOutcome)logMessage[LogDecorator.TestOutcome];
ITestMethod method = (ITestMethod)logMessage[UnitTestLogDecorator.TestMethodMetadata];
ITestClass test = (ITestClass)logMessage[UnitTestLogDecorator.TestClassMetadata];
ScenarioResult sr = (ScenarioResult)logMessage[UnitTestLogDecorator.ScenarioResult];
string storage = CurrentAssemblyName;
string codeBase = CurrentAssemblyName;
string adapterTypeName = TestAdapterTypeName;
string className = test.Name;
string testListName = TestListName;
string computerName = ComputerName;
DateTime startTime = sr.Started;
DateTime endTime = sr.Finished;
_writer.AddTestMethodResult(method, storage, codeBase, adapterTypeName, className, testListName, computerName, startTime, endTime, result);
_writer.IncrementResults(result);
}
}
示例11: IsTestRunFilterMessage
/// <summary>
/// Determines whether a log message has an attached TestRunFilter.
/// </summary>
/// <param name="message">The log message object.</param>
/// <returns>Returns a value indicating whether the condition is met.</returns>
public static bool IsTestRunFilterMessage(LogMessage message)
{
return message.HasDecorator(UnitTestLogDecorator.TestRunFilter);
}
示例12: IsIgnoreMessage
/// <summary>
/// Determines whether a log message meets a specific condition or set
/// of conditions.
/// </summary>
/// <param name="message">The log message object.</param>
/// <returns>Returns true if the condition is met.</returns>
public static bool IsIgnoreMessage(LogMessage message)
{
return message.HasDecorator(UnitTestLogDecorator.IgnoreMessage);
}
示例13: IsUnitTestMessage
/// <summary>
/// Returns a value indicating whether the message is marked as a unit
/// test system message.
/// </summary>
/// <param name="message">The message.</param>
/// <returns>Returns true if the message is a unit test system-marked
/// message.</returns>
private static bool IsUnitTestMessage(LogMessage message)
{
return message.HasDecorator(UnitTestLogDecorator.IsUnitTestMessage);
}
示例14: NotFailedButWithResults
/// <summary>
/// Conditional check, if the message has results and the current state
/// of the run, as tracked by this provider, is "pass".
/// </summary>
/// <param name="message">The log message.</param>
/// <returns>Returns true when the conditions are met.</returns>
private bool NotFailedButWithResults(LogMessage message)
{
// A. Must be in a passing state
// B. Must have results
return (!_hasFailed && message.HasDecorator(LogDecorator.TestOutcome));
}
示例15: IsGranularMessage
/// <summary>
/// Conditional check for the granularity decorator.
/// </summary>
/// <param name="message">The log message.</param>
/// <returns>Returns true if the condition is met.</returns>
private bool IsGranularMessage(LogMessage message)
{
return (message.HasDecorator(LogDecorator.TestGranularity));
}