Esempio n. 1
0
 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) });
     }
 }
Esempio n. 2
0
            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));
                        })
                    });
                }
            }
Esempio n. 3
0
 public static void Context(this string message, Action arrange)
 {
     SpecificationContext.Context(message, arrange);
 }
Esempio n. 4
0
 public static void Assert(this string message, Action assert)
 {
     SpecificationContext.Assert(message, assert);
 }
Esempio n. 5
0
 public static void Do(this string message, Action act)
 {
     SpecificationContext.Do(message, act);
 }
Esempio n. 6
0
 public static void Finally(this string message, Action finallyHandler)
 {
     SpecificationContext.Finally(finallyHandler);
 }