private void HandleDesignTimeMessages(DotnetTestParams dotnetTestParams) { var reportingChannelFactory = new ReportingChannelFactory(); var adapterChannel = reportingChannelFactory.CreateAdapterChannel(dotnetTestParams.Port.Value); try { var pathToAssemblyUnderTest = _assemblyUnderTest; var messages = new TestMessagesCollection(); using (var dotnetTest = new DotnetTest(messages, pathToAssemblyUnderTest)) { var testRunnerFactory = new TestRunnerFactory(_testRunnerNameResolver.ResolveTestRunner(), _commandFactory); dotnetTest .AddNonSpecificMessageHandlers(messages, adapterChannel) .AddTestDiscoveryMessageHandlers(adapterChannel, reportingChannelFactory, testRunnerFactory) .AddTestRunMessageHandlers(adapterChannel, reportingChannelFactory, testRunnerFactory) .AddTestRunnnersMessageHandlers(adapterChannel, reportingChannelFactory); dotnetTest.StartListeningTo(adapterChannel); adapterChannel.Connect(); dotnetTest.StartHandlingMessages(); } } catch (Exception ex) { adapterChannel.SendError(ex); } }
public int RunTests(DotnetTestParams dotnetTestParams) { return(_commandFactory.Create( _testRunnerNameResolver.ResolveTestRunner(), GetCommandArgs(dotnetTestParams), _framework, dotnetTestParams.Config) .Execute() .ExitCode); }