Utility methods for generating values for test parameters.
Ejemplo n.º 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));
        }
Ejemplo n.º 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());
        }