示例#1
0
        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);
            }
        }
示例#2
0
文件: Program.cs 项目: nosoq/cli
        private static void HandleDesignTimeMessages(
            ProjectContext projectContext,
            string testRunner,
            int port,
            string configuration,
            string outputPath)
        {
            var reportingChannelFactory = new ReportingChannelFactory();
            var adapterChannel          = reportingChannelFactory.CreateAdapterChannel(port);

            try
            {
                var assemblyUnderTest = GetAssemblyUnderTest(projectContext, configuration, outputPath);
                var messages          = new TestMessagesCollection();
                using (var dotnetTest = new DotnetTest(messages, assemblyUnderTest))
                {
                    var commandFactory =
                        new ProjectDependenciesCommandFactory(
                            projectContext.TargetFramework,
                            configuration,
                            outputPath,
                            projectContext.ProjectDirectory);

                    var testRunnerFactory = new TestRunnerFactory(GetCommandName(testRunner), commandFactory);

                    dotnetTest
                    .AddNonSpecificMessageHandlers(messages, adapterChannel)
                    .AddTestDiscoveryMessageHandlers(adapterChannel, reportingChannelFactory, testRunnerFactory)
                    .AddTestRunMessageHandlers(adapterChannel, reportingChannelFactory, testRunnerFactory)
                    .AddTestRunnnersMessageHandlers(adapterChannel, reportingChannelFactory);

                    dotnetTest.StartListeningTo(adapterChannel);

                    adapterChannel.Accept();

                    dotnetTest.StartHandlingMessages();
                }
            }
            catch (Exception ex)
            {
                adapterChannel.SendError(ex);
            }
        }
示例#3
0
        private static void HandleDesignTimeMessages(
            ProjectContext projectContext,
            DotnetTestParams dotnetTestParams)
        {
            var reportingChannelFactory = new ReportingChannelFactory();
            var adapterChannel          = reportingChannelFactory.CreateAdapterChannel(dotnetTestParams.Port.Value);

            try
            {
                var pathToAssemblyUnderTest = new AssemblyUnderTest(projectContext, dotnetTestParams).Path;
                var messages = new TestMessagesCollection();
                using (var dotnetTest = new DotnetTest(messages, pathToAssemblyUnderTest))
                {
                    var commandFactory =
                        new ProjectDependenciesCommandFactory(
                            projectContext.TargetFramework,
                            dotnetTestParams.Config,
                            dotnetTestParams.Output,
                            dotnetTestParams.BuildBasePath,
                            projectContext.ProjectDirectory);

                    var testRunnerFactory =
                        new TestRunnerFactory(GetCommandName(projectContext.ProjectFile.TestRunner), 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);
            }
        }
示例#4
0
        private static void HandleDesignTimeMessages(
            ProjectContext projectContext,
            DotnetTestParams dotnetTestParams)
        {
            var reportingChannelFactory = new ReportingChannelFactory();
            var adapterChannel = reportingChannelFactory.CreateAdapterChannel(dotnetTestParams.Port.Value);

            try
            {
                var pathToAssemblyUnderTest = new AssemblyUnderTest(projectContext, dotnetTestParams).Path;
                var messages = new TestMessagesCollection();
                using (var dotnetTest = new DotnetTest(messages, pathToAssemblyUnderTest))
                {
                    var commandFactory =
                        new ProjectDependenciesCommandFactory(
                            projectContext.TargetFramework,
                            dotnetTestParams.Config,
                            dotnetTestParams.Output,
                            dotnetTestParams.BuildBasePath,
                            projectContext.ProjectDirectory);

                    var testRunnerFactory =
                        new TestRunnerFactory(GetCommandName(projectContext.ProjectFile.TestRunner), 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);
            }
        }
示例#5
0
文件: Program.cs 项目: cdmihai/cli
        private static void HandleDesignTimeMessages(
            ProjectContext projectContext,
            string testRunner,
            int port,
            string configuration)
        {
            var reportingChannelFactory = new ReportingChannelFactory();
            var adapterChannel = reportingChannelFactory.CreateChannelWithPort(port);

            try
            {
                var assemblyUnderTest = projectContext.GetOutputPaths(configuration).CompilationFiles.Assembly;
                var messages = new TestMessagesCollection();
                using (var dotnetTest = new DotnetTest(messages, assemblyUnderTest))
                {
                    var commandFactory = new CommandFactory();
                    var testRunnerFactory = new TestRunnerFactory(GetCommandName(testRunner), commandFactory);

                    dotnetTest
                        .AddNonSpecificMessageHandlers(messages, adapterChannel)
                        .AddTestDiscoveryMessageHandlers(adapterChannel, reportingChannelFactory, testRunnerFactory)
                        .AddTestRunMessageHandlers(adapterChannel, reportingChannelFactory, testRunnerFactory)
                        .AddTestRunnnersMessageHandlers(adapterChannel);

                    dotnetTest.StartListeningTo(adapterChannel);

                    adapterChannel.Accept();

                    dotnetTest.StartHandlingMessages();
                }
            }
            catch (Exception ex)
            {
                adapterChannel.SendError(ex);
            }
        }
示例#6
0
文件: Program.cs 项目: ericstj/cli
        private static void HandleDesignTimeMessages(
            ProjectContext projectContext,
            string testRunner,
            int port,
            string configuration,
            string outputPath)
        {
            var reportingChannelFactory = new ReportingChannelFactory();
            var adapterChannel = reportingChannelFactory.CreateAdapterChannel(port);

            try
            {
                var assemblyUnderTest = GetAssemblyUnderTest(projectContext, configuration, outputPath);
                var messages = new TestMessagesCollection();
                using (var dotnetTest = new DotnetTest(messages, assemblyUnderTest))
                {
                    var commandFactory = 
                        new ProjectDependenciesCommandFactory(
                            projectContext.TargetFramework, 
                            configuration, 
                            outputPath,
                            projectContext.ProjectDirectory);
                        
                    var testRunnerFactory = new TestRunnerFactory(GetCommandName(testRunner), commandFactory);

                    dotnetTest
                        .AddNonSpecificMessageHandlers(messages, adapterChannel)
                        .AddTestDiscoveryMessageHandlers(adapterChannel, reportingChannelFactory, testRunnerFactory)
                        .AddTestRunMessageHandlers(adapterChannel, reportingChannelFactory, testRunnerFactory)
                        .AddTestRunnnersMessageHandlers(adapterChannel, reportingChannelFactory);

                    dotnetTest.StartListeningTo(adapterChannel);

                    adapterChannel.Accept();

                    dotnetTest.StartHandlingMessages();
                }
            }
            catch (Exception ex)
            {
                adapterChannel.SendError(ex);
            }
        }