Пример #1
0
        public string FailureSummary(ContextCollection contexts)
        {
            if (contexts.Failures().Count() == 0)
            {
                return("");
            }

            var summary = "\n" + "**** FAILURES ****" + "\n";

            contexts.Failures().Where(t => ExamplesToProcess.Count == 0 || ExamplesToProcess.Contains(GetSpecName(t))).Do(f => summary += WriteFailure(f));
            return(summary);
        }
Пример #2
0
        public void Write(ExampleBase e, int level)
        {
            string name = string.Empty;

            Utilities.GenerateUniqueExampleName(e.Context, ref name, e.Spec);
            if (ExamplesToProcess.Count == 0 || ExamplesToProcess.Contains(GetSpecName(e)))
            {
                var noFailure      = e.Exception == null;
                var failureMessage = noFailure ? "" : " - FAILED - {0}".With(e.Exception.CleanMessage());
                var whiteSpace     = indent.Times(level);
                var result         = e.Pending ? whiteSpace + e.Spec + " - PENDING" : whiteSpace + e.Spec + failureMessage;
                WriteLineDelegate(result);

                if (ExampleProcessed != null)
                {
                    ExampleProcessed(new ExampleEventArgs(e));
                }
            }
        }
Пример #3
0
        public void Write(Context context)
        {
            if (ExamplesToProcess.Count == 0 || context.AllExamples().Any(t => ExamplesToProcess.Contains(GetSpecName(t))))
            {
                if (context.Level == 1)
                {
                    WriteLineDelegate("");
                }


                WriteLineDelegate(indent.Times(context.Level - 1) + context.Name);

                if (context is ClassContext && TestClassProcessed != null)
                {
                    string name = string.Empty;
                    Utilities.GenerateUniqueExampleName(context, ref name);
                    TestClassProcessed(name, eventArgs);
                }
            }
        }
Пример #4
0
        public string Summary(ContextCollection contexts)
        {
            var condition = new Func <ExampleBase, bool>(t => ExamplesToProcess.Count == 0 || ExamplesToProcess.Contains(GetSpecName(t)));

            var summary = "{0} Examples, {1} Failed, {2} Pending".With(
                contexts.Examples().Where(condition).Count(),
                contexts.Failures().Where(condition).Count(),
                contexts.Pendings().Where(condition).Count()
                );

            if (contexts.AnyTaggedWithFocus())
            {
                summary += "\n" + "\n" + @"NSpec found context/examples tagged with ""focus"" and only ran those.";
            }

            return(summary);
        }