forked from microsoft/vstest
/
TestExtensionInitializeEventsHandler.cs
66 lines (56 loc) · 2.26 KB
/
TestExtensionInitializeEventsHandler.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.EventHandlers
{
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
/// <summary>
/// The test run events handler.
/// </summary>
public class TestExtensionInitializeEventsHandler : ITestMessageEventHandler
{
private ITestRequestHandler requestHandler;
/// <summary>
/// Initializes a new instance of the <see cref="TestExtensionInitializeEventsHandler"/> class.
/// </summary>
/// <param name="requestHandler">test request handler</param>
public TestExtensionInitializeEventsHandler(ITestRequestHandler requestHandler)
{
this.requestHandler = requestHandler;
}
/// <summary>
/// Handles a test run message.
/// </summary>
/// <param name="level"> The level. </param>
/// <param name="message"> The message. </param>
public void HandleLogMessage(TestMessageLevel level, string message)
{
switch ((TestMessageLevel)level)
{
case TestMessageLevel.Informational:
EqtTrace.Info(message);
break;
case TestMessageLevel.Warning:
EqtTrace.Warning(message);
break;
case TestMessageLevel.Error:
EqtTrace.Error(message);
break;
default:
EqtTrace.Info(message);
break;
}
this.requestHandler.SendLog(level, message);
}
public void HandleRawMessage(string rawMessage)
{
// No-Op
// TestHost at this point has no functionality where it requires rawmessage
}
}
}