public override IEnumerable <IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) { var results = new List <IXunitTestCase>(); if (testMethod.Method.GetParameters().Any()) { results.Add(new ExecutionErrorTestCase(DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod, "[VsFact] methods are not allowed to have parameters. Did you mean to use [VsTheory]?")); } else if (testMethod.Method.IsGenericMethodDefinition) { results.Add(new ExecutionErrorTestCase(DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod, "[VsFact] methods are not allowed to be generic.")); } else { try { results.AddRange(VsTestCaseFactory.CreateTestCases(testMethod, null, discoveryOptions.MethodDisplayOrDefault(), DiagnosticMessageSink)); } catch (Exception exception) { results.Add(new ExceptionTestCase(exception, DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod)); } } return(results); }
protected override IEnumerable <IXunitTestCase> CreateTestCasesForSkip(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo theoryAttribute, string skipReason) => VsTestCaseFactory.CreateTestCases(testMethod, null, discoveryOptions.MethodDisplayOrDefault(), DiagnosticMessageSink);
protected override IEnumerable <IXunitTestCase> CreateTestCasesForDataRow(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo theoryAttribute, object[] dataRow) => VsTestCaseFactory.CreateTestCases(testMethod, dataRow, discoveryOptions.MethodDisplayOrDefault(), DiagnosticMessageSink);