public TestResult GetVisualStudioTestResult(ContextInfo context, SpecificationInfo specification, Result result)
        {
            var vsResult = new TestResult(GetVisualStudioTest(context, specification));
            switch (result.Status)
            {
                case Status.Failing:
                    vsResult.Outcome = TestOutcome.Failed;
                    vsResult.ErrorMessage = result.Exception.Message;
                    vsResult.ErrorStackTrace = result.Exception.StackTrace;
                    break;
                case Status.Passing:
                    vsResult.Outcome = TestOutcome.Passed;
                    break;
                case Status.NotImplemented:
                    vsResult.Outcome = TestOutcome.NotFound;
                    break;
                case Status.Ignored:
                    vsResult.Outcome = TestOutcome.Skipped;
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            vsResult.Messages.Add(context.CapturedOutput);
            vsResult.Messages.Add(specification.CapturedOutput);
            return vsResult;
        }
예제 #2
0
        public void RecordResult(TestResult testResult)
        {
            if (testResult == null)
            {
                throw new ArgumentNullException(nameof(testResult));
            }

            _channel.Send(new Message
            {
                MessageType = "TestExecution.TestResult",
                Payload = JToken.FromObject(testResult),
            });
        }