Ejemplo n.º 1
0
        public RunResult RunSpecification(SpecificationToRun spec)
        {
            var method = typeof(SpecificationRunner).GetMethod("Run", BindingFlags.NonPublic | BindingFlags.Instance);
            var tomake =
                spec.Specification.GetType().GetInterfaces().Single(
                    x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(TypedSpecification <>));
            var generic = method.MakeGenericMethod(tomake.GetGenericArguments()[0]);
            var result  = (RunResult)generic.Invoke(this, new[] { spec.Specification });

            result.FoundOnMemberInfo = spec.FoundOn;
            return(result);
        }
Ejemplo n.º 2
0
        public void _(SpecificationToRun spec)
        {
            var result = new SpecificationRunner().RunSpecification(spec);

            spec.Specification.Document(result);
            if (!result.Passed)
            {
                if (result.Thrown != null)
                {
                    throw result.Thrown;
                }
                Assert.Fail(result.Message ?? "<null>");
            }
        }
Ejemplo n.º 3
0
 static string Name(SpecificationToRun r)
 {
     return((r.Specification.GetName() ?? r.FoundOn.Name).CleanupName() + " ");
 }