Esempio n. 1
0
        private bool TryProcessDataSource(UnitTestElement test, TestMethodInfo testMethodInfo, ITestContext testContext, List <UnitTestElement> tests)
        {
            var dataSourceAttributes = ReflectHelper.GetAttributes <UTF.DataSourceAttribute>(testMethodInfo.MethodInfo, false);

            if (dataSourceAttributes == null)
            {
                return(false);
            }

            if (dataSourceAttributes.Length > 1)
            {
                var message = string.Format(CultureInfo.CurrentCulture, Resource.CannotEnumerateDataSourceAttribute_MoreThenOneDefined, test.TestMethod.ManagedTypeName, test.TestMethod.ManagedMethodName, dataSourceAttributes.Length);
                PlatformServiceProvider.Instance.AdapterTraceLogger.LogInfo($"DynamicDataEnumarator: {message}");
                throw new InvalidOperationException(message);
            }

            // dataSourceAttributes.Length == 1
            try
            {
                return(this.ProcessDataSourceTests(test, testMethodInfo, testContext, tests));
            }
            catch (Exception ex)
            {
                var message = string.Format(CultureInfo.CurrentCulture, Resource.CannotEnumerateDataSourceAttribute, test.TestMethod.ManagedTypeName, test.TestMethod.ManagedMethodName, ex);
                PlatformServiceProvider.Instance.AdapterTraceLogger.LogInfo($"DynamicDataEnumarator: {message}");
                return(false);
            }
        }
Esempio n. 2
0
 public TAttributeType[] GetAttributes <TAttributeType>(bool inherit)
     where TAttributeType : Attribute
 => ReflectHelper.GetAttributes <TAttributeType>(this.TestMethod, inherit)
 ?? EmptyHolder <TAttributeType> .Array;
Esempio n. 3
0
 public TAttributeType[] GetAttributes <TAttributeType>(bool inherit)
     where TAttributeType : Attribute => ReflectHelper.GetAttributes <TAttributeType>(this.TestMethod, inherit);