Пример #1
0
        public void ValidateSpec()
        {
            var finder = new SpecFinder(new[] {GetType()});
            var builder = new ContextBuilder(finder, new DefaultConventions());

            ContextCollection result = new ContextRunner(builder, new MyFormatter(), false).Run(builder.Contexts().Build());

            if(result.Failures() == null)
            {
                Assert.Fail("*****   Failed to execute some tests   *****");
            }

            var crashes = result.AllContexts().Where(context => context.Exception != null).ToList();
            if(crashes.Any())
            {
                throw new SpecificationException("unknown", crashes.First().Exception);
            }

            if(result.Failures().Any())
            {
                throw new SpecificationException("unknown", result.First().Exception);
            }
        }
Пример #2
0
        public void AllTests()
        {
            var finder = new ShimFinder(typeof(RunnerShim).Assembly.GetTypes());

            var builder = new ContextBuilder(finder, new DefaultConventions());

            var runner = new ContextRunner(builder);

            runner.Run();
            var results = runner.Failures();
            if (results.Count() != 0) {
                foreach (var result in results)
                    Assert.Fail(String.Format("{0} failed because of {1}", result.Spec, result.Exception));
            } else {

            } Assert.Pass("All " + runner.Examples().Count() + " passed");
        }