2016-02-12 18:22:35 -08:00
|
|
|
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
|
|
|
|
|
|
using Microsoft.Extensions.Testing.Abstractions;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Tools.Test
|
|
|
|
|
{
|
|
|
|
|
public class TestRunnerTestStartedMessageHandler : TestRunnerResultMessageHandler
|
|
|
|
|
{
|
|
|
|
|
public TestRunnerTestStartedMessageHandler(IReportingChannel adapterChannel)
|
|
|
|
|
: base(adapterChannel, DotnetTestState.TestExecutionStarted, TestMessageTypes.TestExecutionStarted)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool CanHandleMessage(IDotnetTest dotnetTest, Message message)
|
|
|
|
|
{
|
2016-02-25 17:36:13 -08:00
|
|
|
|
return IsAtAnAcceptableState(dotnetTest) &&
|
2016-02-12 18:22:35 -08:00
|
|
|
|
message.MessageType == TestMessageTypes.TestRunnerTestStarted;
|
|
|
|
|
}
|
2016-02-25 17:36:13 -08:00
|
|
|
|
|
|
|
|
|
private static bool IsAtAnAcceptableState(IDotnetTest dotnetTest)
|
|
|
|
|
{
|
|
|
|
|
return dotnetTest.State == DotnetTestState.TestExecutionSentTestRunnerProcessStartInfo ||
|
|
|
|
|
dotnetTest.State == DotnetTestState.TestExecutionStarted;
|
|
|
|
|
}
|
2016-02-12 18:22:35 -08:00
|
|
|
|
}
|
|
|
|
|
}
|