/// <summary>
        /// Creates test commands.
        /// </summary>
        /// <param name="testMethod">
        /// Information about a test method.
        /// </param>
        /// <param name="builderFactory">
        /// A factory of test fixture.
        /// </param>
        /// <returns>
        /// The new test commands.
        /// </returns>
        public IEnumerable<ITestCommand> Create(IMethodInfo testMethod, ISpecimenBuilderFactory builderFactory)
        {
            if (testMethod.MethodInfo.GetParameters().Length == 0)
                yield break;

            yield return new ParameterizedCommand(
                new ParameterizedCommandContext(testMethod, builderFactory, new object[0]));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ParameterizedCommandContext"/> class.
        /// </summary>
        /// <param name="testMethod">
        /// A test method.
        /// </param>
        /// <param name="factory">
        /// A factory to create test fixture.
        /// </param>
        /// <param name="arguments">
        /// Explicit arguments of the test method.
        /// </param>
        public ParameterizedCommandContext(
            IMethodInfo testMethod, ISpecimenBuilderFactory factory, IEnumerable<object> arguments)
            : base(factory, arguments)
        {
            if (testMethod == null)
                throw new ArgumentNullException("testMethod");

            this.testMethod = testMethod;
        }
        /// <summary>
        /// Creates test commands.
        /// </summary>
        /// <param name="testMethod">
        /// Information about a test method.
        /// </param>
        /// <param name="builderFactory">
        /// A factory of test fixture.
        /// </param>
        /// <returns>
        /// The new test commands.
        /// </returns>
        public IEnumerable<ITestCommand> Create(IMethodInfo testMethod, ISpecimenBuilderFactory builderFactory)
        {
            if (testMethod == null)
                throw new ArgumentNullException("testMethod");

            if (testMethod.MethodInfo.GetParameters().Any())
                yield break;

            yield return new FactCommand(testMethod);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TestCommandContext"/> class.
        /// </summary>
        /// <param name="factory">
        /// A factory to create test fixture.
        /// </param>
        /// <param name="arguments">
        /// Explicit arguments of the test method.
        /// </param>
        protected TestCommandContext(ISpecimenBuilderFactory factory, IEnumerable<object> arguments)
        {
            if (factory == null)
                throw new ArgumentNullException("factory");

            if (arguments == null)
                throw new ArgumentNullException("arguments");

            this.factory = factory;
            this.arguments = arguments;
        }
        /// <summary>
        /// Creates test commands.
        /// </summary>
        /// <param name="testMethod">
        /// Information about a test method.
        /// </param>
        /// <param name="builderFactory">
        /// A factory of test fixture.
        /// </param>
        /// <returns>
        /// The new test commands.
        /// </returns>
        public IEnumerable<ITestCommand> Create(IMethodInfo testMethod, ISpecimenBuilderFactory builderFactory)
        {
            foreach (var factory in this.factories)
            {
                int count = 0;
                var testCommands = factory.Create(testMethod, builderFactory);
                foreach (var testCommand in testCommands)
                {
                    count++;
                    yield return testCommand;
                }

                if (count != 0)
                    yield break;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="StaticTestCaseCommandContext"/> class.
        /// </summary>
        /// <param name="testMethod">
        /// A test method.
        /// </param>
        /// <param name="actualMethod">
        /// A actual method.
        /// </param>
        /// <param name="factory">
        /// A factory to create test fixture.
        /// </param>
        /// <param name="arguments">
        /// Explicit arguments of the actual method.
        /// </param>
        public StaticTestCaseCommandContext(
            IMethodInfo testMethod,
            IMethodInfo actualMethod,
            ISpecimenBuilderFactory factory,
            IEnumerable<object> arguments)
            : base(factory, arguments)
        {
            if (testMethod == null)
                throw new ArgumentNullException("testMethod");

            if (actualMethod == null)
                throw new ArgumentNullException("actualMethod");

            this.testMethod = testMethod;
            this.actualMethod = actualMethod;
        }
        /// <summary>
        /// Creates test commands.
        /// </summary>
        /// <param name="testMethod">
        /// Information about a test method.
        /// </param>
        /// <param name="builderFactory">
        /// A factory of test fixture.
        /// </param>
        /// <returns>
        /// The new test commands.
        /// </returns>
        public IEnumerable<ITestCommand> Create(IMethodInfo testMethod, ISpecimenBuilderFactory builderFactory)
        {
            if (testMethod == null)
                throw new ArgumentNullException("testMethod");

            var attributes = testMethod.MethodInfo
                .GetCustomAttributes(typeof(DataAttribute), false).Cast<DataAttribute>();

            if (!attributes.Any())
                return Enumerable.Empty<ITestCommand>();

            var parameterTypes = testMethod.MethodInfo.GetParameters()
                .Select(p => p.ParameterType).ToArray();

            return from attribute in attributes
                   from data in attribute.GetData(testMethod.MethodInfo, parameterTypes)
                   select new ParameterizedCommand(
                       new ParameterizedCommandContext(testMethod, builderFactory, data));
        }