Пример #1
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            using (Foreground.Red)
                Console.WriteLine("Test '{0}' failed: {1}", @case.Name, result.PrimaryExceptionTypeName());
            result.WriteCompoundStackTraceTo(Console.Out);
            Console.WriteLine();
            Console.WriteLine();
        }
Пример #2
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            using (Foreground.Red)
                Console.WriteLine("Test '{0}' failed: {1}", @case.Name, result.PrimaryExceptionTypeName());
            result.WriteCompoundStackTraceTo(Console.Out);
            Console.WriteLine();
            Console.WriteLine();
        }
Пример #3
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            tdnet.TestFinished(new TestResult
            {
                Name = @case.Name,
                State = TestState.Failed,
                Message = result.PrimaryExceptionTypeName(),
                StackTrace = result.CompoundStackTrace(),
            });
        }
Пример #4
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            tdnet.TestFinished(new TestResult
            {
                Name       = @case.Name,
                State      = TestState.Failed,
                Message    = result.PrimaryExceptionTypeName(),
                StackTrace = result.CompoundStackTrace(),
            });
        }
Пример #5
0
        public ConventionResult Execute(Listener listener, params Type[] candidateTypes)
        {
            var conventionResult = new ConventionResult(GetType().FullName);

            foreach (var testClass in Classes.Filter(candidateTypes))
            {
                var classResult = new ClassResult(testClass.FullName);

                var methods = Methods.Filter(testClass);

                var cases = methods.SelectMany(method => CasesForMethod(testClass, method)).ToArray();
                var casesBySkipState = cases.ToLookup(CaseExecution.SkipPredicate);
                var casesToSkip = casesBySkipState[true];
                var casesToExecute = casesBySkipState[false];
                foreach (var @case in casesToSkip)
                {
                    listener.CaseSkipped(@case);
                    classResult.Add(CaseResult.Skipped(@case.Name, CaseExecution.SkipReasonProvider(@case)));
                }

                var caseExecutions = casesToExecute.Select(@case => new CaseExecution(@case)).ToArray();
                if (caseExecutions.Any())
                {
                    ClassExecution.Behavior.Execute(testClass, this, caseExecutions);

                    foreach (var caseExecution in caseExecutions)
                    {
                        if (caseExecution.Exceptions.Any())
                        {
                            var failResult = new FailResult(caseExecution);
                            listener.CaseFailed(failResult);
                            classResult.Add(CaseResult.Failed(failResult.Case.Name, failResult.Duration, failResult.PrimaryExceptionMessage(), failResult.CompoundStackTrace(), failResult.PrimaryExceptionTypeName()));
                        }
                        else
                        {
                            var passResult = new PassResult(caseExecution);
                            listener.CasePassed(passResult);
                            classResult.Add(CaseResult.Passed(passResult.Case.Name, passResult.Duration));
                        }
                    }

                }

                conventionResult.Add(classResult);
            }

            return conventionResult;
        }