@@ -5,12 +5,14 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.DesignMode
55{
66 using System ;
77 using System . Collections . Generic ;
8+ using System . Data ;
89 using System . Globalization ;
910 using System . Net ;
1011 using System . Threading ;
1112 using System . Threading . Tasks ;
1213
1314 using Microsoft . VisualStudio . TestPlatform . Client . RequestHelper ;
15+ using Microsoft . VisualStudio . TestPlatform . Common . Logging ;
1416 using Microsoft . VisualStudio . TestPlatform . Common . Utilities ;
1517 using Microsoft . VisualStudio . TestPlatform . CommunicationUtilities ;
1618 using Microsoft . VisualStudio . TestPlatform . CommunicationUtilities . Interfaces ;
@@ -41,6 +43,8 @@ public class DesignModeClient : IDesignModeClient
4143
4244 protected Action < Message > onAckMessageReceived ;
4345
46+ private TestSessionMessageLogger testSessionMessageLogger ;
47+
4448 /// <summary>
4549 /// Initializes a new instance of the <see cref="DesignModeClient"/> class.
4650 /// </summary>
@@ -66,6 +70,8 @@ internal DesignModeClient(ICommunicationManager communicationManager, IDataSeria
6670 this . communicationManager = communicationManager ;
6771 this . dataSerializer = dataSerializer ;
6872 this . platformEnvironment = platformEnvironment ;
73+ this . testSessionMessageLogger = TestSessionMessageLogger . Instance ;
74+ this . testSessionMessageLogger . TestRunMessage += this . TestRunMessageHandler ;
6975 }
7076
7177 /// <summary>
@@ -171,7 +177,7 @@ private void ProcessRequests(ITestRequestManager testRequestManager)
171177
172178 case MessageType . StartDiscovery :
173179 {
174- var discoveryPayload = this . dataSerializer . DeserializePayload < DiscoveryRequestPayload > ( message ) ;
180+ var discoveryPayload = this . dataSerializer . DeserializePayload < DiscoveryRequestPayload > ( message ) ;
175181 this . StartDiscovery ( discoveryPayload , testRequestManager ) ;
176182 break ;
177183 }
@@ -311,6 +317,20 @@ public void SendTestMessage(TestMessageLevel level, string message)
311317 this . communicationManager . SendMessage ( MessageType . TestMessage , payload ) ;
312318 }
313319
320+ /// <summary>
321+ /// Sends the test session logger warning and error messages to IDE;
322+ /// </summary>
323+ /// <param name="sender"></param>
324+ /// <param name="e"></param>
325+ public void TestRunMessageHandler ( object sender , TestRunMessageEventArgs e )
326+ {
327+ if ( e . Level == TestMessageLevel . Error || e . Level == TestMessageLevel . Warning )
328+ {
329+ var payload = new TestMessagePayload { MessageLevel = e . Level , Message = e . Message } ;
330+ this . communicationManager . SendMessage ( MessageType . TestMessage , payload ) ;
331+ }
332+ }
333+
314334 private void StartTestRun ( TestRunRequestPayload testRunPayload , ITestRequestManager testRequestManager , bool skipTestHostLaunch )
315335 {
316336 Task . Run (
0 commit comments