GetValuesFor() static private method

Gets a sequence of values that should be tested for the specified parameter.
static private GetValuesFor ( ParameterInfo parameter ) : IEnumerable
parameter System.Reflection.ParameterInfo The parameter to get possible values for.
return IEnumerable
コード例 #1
0
        /// <inheritdoc />
        public override IEnumerable <object[]> GetData(MethodInfo testMethod)
        {
            Requires.NotNull(testMethod, nameof(testMethod));

            var parameters = testMethod.GetParameters();

            if (parameters.Length == 0)
            {
                return(Enumerable.Empty <object[]>());
            }

            var values = new List <object> [parameters.Length];

            for (int i = 0; i < parameters.Length; i++)
            {
                values[i] = ValuesUtilities.GetValuesFor(parameters[i]).ToList();
            }

            var currentValues = new object[parameters.Length];

            return(this.FillCombinations(parameters, values, currentValues, 0));
        }
コード例 #2
0
        /// <inheritdoc />
        public override IEnumerable <object[]> GetData(MethodInfo testMethod)
        {
            Requires.NotNull(testMethod, nameof(testMethod));

            var parameters = testMethod.GetParameters();

            if (parameters.Length == 0)
            {
                return(Enumerable.Empty <object[]>());
            }

            var values = new List <object> [parameters.Length];

            for (int i = 0; i < parameters.Length; i++)
            {
                values[i] = ValuesUtilities.GetValuesFor(parameters[i]).ToList();
            }

            var testCaseInfo = PairwiseStrategy.GetTestCases(values.Select(v => v.Count).ToArray());

            return(from testCase in testCaseInfo
                   select testCase.Select((j, i) => values[i][j]).ToArray());
        }