Ejemplo n.º 1
0
        /// <inheritdoc />
        public override TestResult[] Execute(ITestMethod testMethod)
        {
            var dataSourceAttributes = testMethod.MethodInfo.GetCustomAttributes().OfType <ITestDataSource>().Where(dataSourceAttribute => !(dataSourceAttribute is AutoDataAttribute));

            if (dataSourceAttributes.Any())
            {
                return(base.Execute(testMethod));
            }

            // If there are no other ITestDataSource attributes on this test method, then use AutoFixture to generate the arguments for a single test run.
            var testMethodInfo = testMethod.ToTestMethodInfo();

            var fixture   = TestMethodFixtureSource.GetFixture(testMethodInfo);
            var arguments = TestMethodArgumentResolver.GetTestMethodArguments(fixture, testMethodInfo);

            return(new[] { testMethod.Invoke(arguments.ToArray()) });
        }