Пример #1
0
        private static IEnumerable <object[]> GetData(DataAttribute dataAttribute, [CallerMemberName] string testMethodName = null)
        {
            Requires.NotNull(dataAttribute, nameof(dataAttribute));
            Requires.NotNullOrEmpty(testMethodName, nameof(testMethodName));

            string supposeMethodName = testMethodName.Replace("GetData_", "Suppose_");
            var    methodInfo        = typeof(CombinatorialDataAttributeTests).GetTypeInfo()
                                       .DeclaredMethods.First(m => m.Name == supposeMethodName);

            return(dataAttribute.GetData(methodInfo));
        }
Пример #2
0
        public override IEnumerable <object[]> GetData(MethodInfo testMethod)
        {
            if (testMethod == null)
            {
                throw new ArgumentNullException(paramName: nameof(testMethod));
            }

            List <object[]> data = _baseAttribute.GetData(testMethod).ToList();
            var             autoDataAttribute = new AutoMoqDataAttribute(data.Select(datum => datum.Length).Max());

            foreach (object[] datum in data)
            {
                object[] autoData = autoDataAttribute.GetData(testMethod).ToArray()[0];

                for (var i = 0; i < datum.Length; i++)
                {
                    autoData[i] = datum[i];
                }

                yield return(autoData);
            }
        }
        private static IEnumerable<object[]> GetData(DataAttribute dataAttribute, [CallerMemberName] string testMethodName = null)
        {
            Requires.NotNull(dataAttribute, nameof(dataAttribute));
            Requires.NotNullOrEmpty(testMethodName, nameof(testMethodName));

            string supposeMethodName = testMethodName.Replace("GetData_", "Suppose_");
            var methodInfo = typeof(CombinatorialDataAttributeTests).GetTypeInfo()
                .DeclaredMethods.First(m => m.Name == supposeMethodName);
            return dataAttribute.GetData(methodInfo);
        }