protected override IEnumerable <ITestCommand> EnumerateTestCommands(IMethodInfo method) { try { object obj = Activator.CreateInstance(method.MethodInfo.ReflectedType); method.Invoke(obj, null); return(SpecificationContext.ToTestCommands(method)); } catch (Exception ex) { return(new ITestCommand[] { new ExceptionTestCommand(method, ex) }); } }
public static IEnumerable <ITestCommand> SafelyEnumerateTestCommands(IMethodInfo method, Action <IMethodInfo> registerPrimitives) { try { registerPrimitives(method); IEnumerable <ITestCommand> testCommands = SpecificationContext.BuildCommandsFromRegisteredPrimitives(method); return(testCommands); } catch (Exception ex) { return(new ITestCommand[] { new SubSpec.Core.ExceptionTestCommand(method, () => { throw new InvalidOperationException(string.Format("An exception was thrown while building tests from Specification {0}.{1}:\r\n" + ex.ToString(), method.TypeName, method.Name)); }) }); } }
public static void Context(this string message, Action arrange) { SpecificationContext.Context(message, arrange); }
public static void Assert(this string message, Action assert) { SpecificationContext.Assert(message, assert); }
public static void Do(this string message, Action act) { SpecificationContext.Do(message, act); }
public static void Finally(this string message, Action finallyHandler) { SpecificationContext.Finally(finallyHandler); }