本文整理汇总了C#中Microsoft.Silverlight.Testing.Harness.LogMessage类的典型用法代码示例。如果您正苦于以下问题:C# LogMessage类的具体用法?C# LogMessage怎么用?C# LogMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogMessage类属于Microsoft.Silverlight.Testing.Harness命名空间,在下文中一共展示了LogMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanTranslate
public bool CanTranslate(LogMessage message)
{
if (message.MessageType == LogMessageType.TestResult)
{
if (message.Is(TestGranularity.TestScenario)
&& message.DecoratorMatches(LogDecorator.TestOutcome, v =>
{
switch ((TestOutcome)v)
{
case TestOutcome.Failed:
case TestOutcome.Timeout:
case TestOutcome.Inconclusive:
//TODO: reproduce case TestOutcome.Error:
return true;
default:
return false;
}
})
&& message.DecoratorMatches(UnitTestLogDecorator.ScenarioResult, v => ((ScenarioResult)v).Exception != null)
)
{
return true;
}
}
return false;
}
示例2: ProcessRemainder
protected override void ProcessRemainder(LogMessage message)
{
//DEBUG
//var msg = TraceLogMessage(message);
//Console.WriteLine(msg.Message);
try
{
ClientEvent clientEvent;
if (TryTranslateIntoClientEvent(message, out clientEvent))
{
if (clientEvent != null)
Server.PostMessage(clientEvent);
}
else
{
var traceClientEvent = TraceLogMessage(message);
Server.PostMessage(traceClientEvent);
}
}
catch (Exception ex)
{
var messageObject = new UnhandledExceptionClientEvent
{
Exception = ex,
};
Server.PostMessage(messageObject);
}
}
示例3: 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());
}
示例4: Process
public override void Process(LogMessage logMessage) {
if(isFirstMessage) {
isFirstMessage = false;
ProcessStartMessage();
} else
if(logMessage.HasDecorator(LogDecorator.TestOutcome))
ProcessResultMessage(logMessage);
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例8: Translate
public ClientEvent Translate(LogMessage message)
{
var testMethod = (ITestMethod)message.Decorators[UnitTestLogDecorator.TestMethodMetadata];
var clientEventX = new TestExecutionMethodBeginClientEvent
{
Started = DateTime.Now,
};
clientEventX.AssignTestExecutionMethodInfo(testMethod);
return clientEventX;
}
示例9: Translate
public ClientEvent Translate(LogMessage message)
{
var testClass = (ITestClass)message.Decorators[UnitTestLogDecorator.TestClassMetadata];
var clientEventX = new TestExecutionClassBeginClientEvent
{
ClassName = testClass.Type.ClassNameIncludingParentsIfNested(),
NamespaceName = testClass.Type.Namespace,
};
return clientEventX;
}
示例10: CanTranslate
public bool CanTranslate(LogMessage message)
{
if (message.MessageType == LogMessageType.TestInfrastructure)
{
if (message.Message.Equals("Initialization of UnitTestHarness", StringComparison.InvariantCultureIgnoreCase))
{
return true;
}
}
return false;
}
示例11: 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);
}
}
}
示例12: CanTranslate
public bool CanTranslate(LogMessage message)
{
if (message.MessageType == LogMessageType.TestExecution)
{
if (message.Is(TestGranularity.TestScenario)
&& message.DecoratorMatches(UnitTestLogDecorator.IgnoreMessage, v => (bool)v)
)
{
return true;
}
}
return false;
}
示例13: CanTranslate
public bool CanTranslate(LogMessage message)
{
if (message.MessageType == LogMessageType.TestResult)
{
if (message.Is(TestGranularity.TestScenario)
&& message.DecoratorMatches(LogDecorator.TestOutcome, v => (TestOutcome)v == TestOutcome.Passed)
)
{
return true;
}
}
return false;
}
示例14: Translate
public ClientEvent Translate(LogMessage message)
{
var scenarioResult = (ScenarioResult)message.Decorators[UnitTestLogDecorator.ScenarioResult];
var testMethod = (ITestMethod)message.Decorators[UnitTestLogDecorator.TestMethodMetadata];
var clientEventX = new TestExecutionMethodPassedClientEvent
{
Finished = scenarioResult.Finished,
Started = scenarioResult.Started,
};
clientEventX.AssignTestExecutionMethodInfo(testMethod);
return clientEventX;
}
示例15: CanTranslate
public bool CanTranslate(LogMessage message)
{
if (message.MessageType == LogMessageType.TestExecution)
{
if (message.Is(TestStage.Starting)
&& message.Is(TestGranularity.TestScenario)
&& message.DecoratorMatches(UnitTestLogDecorator.TestMethodMetadata, v => v is ITestMethod)
)
{
return true;
}
}
return false;
}