예제 #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);
        }
예제 #2
0
파일: Specs.cs 프로젝트: deke/lokad-cqrs
        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>");
            }
        }
예제 #3
0
파일: Specs.cs 프로젝트: deke/lokad-cqrs
 static string Name(SpecificationToRun r)
 {
     return((r.Specification.GetName() ?? r.FoundOn.Name).CleanupName() + " ");
 }