Beispiel #1
0
        public void BuildMethodContexts(Context classContext, Type specClass)
        {
            specClass.Methods().Where(s => !reservedMethods.Contains(s.Name)).Do(
                contextMethod =>
            {
                var methodContext = new MethodContext(contextMethod);

                classContext.AddContext(methodContext);
            });
        }
Beispiel #2
0
        public void BuildMethodContexts(Context classContext, Type specClass)
        {
            specClass.Methods().Where(s => !reservedMethods.Contains(s.Name)).Do(
                contextMethod =>
                {
                    var methodContext = new MethodContext(contextMethod);

                    classContext.AddContext(methodContext);
                });
        }
Beispiel #3
0
        public void BuildMethodContexts(Context classContext, Type specClass)
        {
            specClass
            .Methods()
            .Where(s => conventions.IsMethodLevelContext(s.Name))
            .Do(contextMethod =>
            {
                var methodContext = new MethodContext(contextMethod, TagStringFor(contextMethod));

                classContext.AddContext(methodContext);
            });
        }
Beispiel #4
0
        public void BuildMethodContexts(Context classContext, Type specClass)
        {
            specClass
                .Methods()
                .Where(s => conventions.IsMethodLevelContext(s.Name))
                .Do(contextMethod =>
                {
                    var methodContext = new MethodContext(contextMethod, TagStringFor(contextMethod));

                    classContext.AddContext(methodContext);
                });
        }
        /// <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;
        }