コード例 #1
0
        public DotnetTestState HandleMessage(IDotnetTest dotnetTest, Message message)
        {
            var error = $"No handler for message '{message.MessageType}' when at state '{dotnetTest.State}'";

            TestHostTracing.Source.TraceEvent(TraceEventType.Error, 0, error);

            _adapterChannel.SendError(error);

            throw new InvalidOperationException(error);
        }
コード例 #2
0
        private void DiscoverTests(IDotnetTest dotnetTest)
        {
            var testRunnerResults = Enumerable.Empty <Message>();

            try
            {
                var testRunnerChannel = _reportingChannelFactory.CreateTestRunnerChannel();

                dotnetTest.StartListeningTo(testRunnerChannel);

                testRunnerChannel.Connect();

                var testRunner = _testRunnerFactory.CreateTestRunner(
                    new DiscoverTestsArgumentsBuilder(dotnetTest.PathToAssemblyUnderTest, testRunnerChannel.Port));

                testRunner.RunTestCommand();
            }
            catch (TestRunnerOperationFailedException e)
            {
                _adapterChannel.SendError(e.Message);
            }
        }