GlobalGameJame/Library/PackageCache/com.unity.test-framework@1.1.9/UnityEditor.TestRunner/UnityTestProtocol/UtpMessageReporter.cs
JonatanRek bea2dce063 Initial
test
2020-01-31 16:10:04 +01:00

58 lines
1.6 KiB
C#

using System.Collections.Generic;
using System.Linq;
using UnityEditor.Compilation;
using UnityEditor.TestTools.TestRunner.Api;
namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol
{
internal class UtpMessageReporter : IUtpMessageReporter
{
public ITestRunnerApiMapper TestRunnerApiMapper;
public IUtpLogger Logger;
public UtpMessageReporter(IUtpLogger utpLogger)
{
TestRunnerApiMapper = new TestRunnerApiMapper();
Logger = utpLogger;
}
public void ReportAssemblyCompilationErrors(string assembly, IEnumerable<CompilerMessage> errorCompilerMessages)
{
var compilationErrorMessage = new AssemblyCompilationErrorsMessage
{
assembly = assembly,
errors = errorCompilerMessages.Select(x => x.message).ToArray()
};
Logger.Log(compilationErrorMessage);
}
public void ReportTestRunStarted(ITestAdaptor testsToRun)
{
var msg = TestRunnerApiMapper.MapTestToTestPlanMessage(testsToRun);
Logger.Log(msg);
}
public void ReportTestStarted(ITestAdaptor test)
{
if (test.IsSuite)
return;
var msg = TestRunnerApiMapper.MapTestToTestStartedMessage(test);
Logger.Log(msg);
}
public void ReportTestFinished(ITestResultAdaptor result)
{
if (result.Test.IsSuite)
return;
var msg = TestRunnerApiMapper.TestResultToTestFinishedMessage(result);
Logger.Log(msg);
}
}
}