/// <summary> /// Obtains all test commands to call all examples contained in a given <see cref="T:IMethodInfo"/>. /// </summary> /// <param name="method">The method to scan.</param> /// <returns>All test commands to call all examples contained in <paramref name="method"/>.</returns> internal static IEnumerable<ITestCommand> CreateForMethod(IMethodInfo method) { //create a new instance of our specification var instance = method.CreateInstance() as nspec; if (instance == null) //not a nspec instance, nothing for us here. { return Enumerable.Empty<ITestCommand>(); } var context = new MethodContext(method.MethodInfo); context.Build(instance); var commands = new List<ITestCommand>(); BuildCommandList(method, instance, context, commands); return commands; }