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); }
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>"); } }
static string Name(SpecificationToRun r) { return((r.Specification.GetName() ?? r.FoundOn.Name).CleanupName() + " "); }