public TestHostLogger(string name, ReportingChannel channel)
 {
     _name = name;
     _channel = channel;
 }
 public TestExecutionSink(ReportingChannel channel)
 {
     _channel = channel;
 }
 public TestHostLoggerProvider(ReportingChannel channel)
 {
     _channel = channel;
 }
 public TestDiscoverySink(ReportingChannel channel)
 {
     _channel = channel;
 }
Example #5
0
 public TestExecutionSink(ReportingChannel channel)
 {
     _channel = channel;
 }
Example #6
0
 public TestDiscoverySink(ReportingChannel channel)
 {
     _channel = channel;
 }
Example #7
0
        private async Task ExecuteTests(int port, string projectPath, IList <string> tests)
        {
            Console.WriteLine("Listening on port {0}", port);
            using (var channel = await ReportingChannel.ListenOn(port))
            {
                Console.WriteLine("Client accepted {0}", channel.Socket.LocalEndPoint);

                string  testCommand = null;
                Project project     = null;
                if (Project.TryGetProject(projectPath, out project))
                {
                    project.Commands.TryGetValue("test", out testCommand);
                }

                if (testCommand == null)
                {
                    // No test command means no tests.
                    Trace.TraceInformation("[ReportingChannel]: OnTransmit(ExecuteTests)");
                    channel.Send(new Message()
                    {
                        MessageType = "TestExecution.Response",
                    });

                    return;
                }

                var testServices = new ServiceProvider(_services);
                testServices.Add(typeof(ITestExecutionSink), new TestExecutionSink(channel));

                var args = new List <string>()
                {
                    "test",
                    "--designtime"
                };

                if (tests != null)
                {
                    foreach (var test in tests)
                    {
                        args.Add("--test");
                        args.Add(test);
                    }
                }

                try
                {
                    await ProjectCommand.Execute(testServices, project, args.ToArray());
                }
                catch
                {
                    // For now we're not doing anything with these exceptions, we might want to report them
                    // to VS.
                }

                Trace.TraceInformation("[ReportingChannel]: OnTransmit(ExecuteTests)");
                channel.Send(new Message()
                {
                    MessageType = "TestExecution.Response",
                });
            }
        }