You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/xunit.analyzers/rules/index.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,7 @@ title: Roslyn Analyzer Rules
59
59
| [xUnit1049](/xunit.analyzers/rules/xUnit1049) | ::v2::{.label .label-version-False} ::v3::{.label .label-version-True} | ::Error::{.label .label-Error} | Do not use 'async void' for test methods as it is no longer supported
60
60
| [xUnit1050](/xunit.analyzers/rules/xUnit1050) | ::v2::{.label .label-version-False} ::v3::{.label .label-version-True} | ::Info::{.label .label-Info} | The class referenced by the ClassData attribute returns untyped data rows
61
61
| [xUnit1051](/xunit.analyzers/rules/xUnit1051) | ::v2::{.label .label-version-False} ::v3::{.label .label-version-True} | ::Warning::{.label .label-Warning} | Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken
62
+
| [xUnit1052](/xunit.analyzers/rules/xUnit1052) | ::v2::{.label .label-version-False} ::v3::{.label .label-version-True} | ::Warning::{.label .label-Warning} | Avoid using 'TheoryData<...>' with types that implement 'ITheoryDataRow'
description: Avoid using 'TheoryData<...>' with types that implement 'ITheoryDataRow'
5
+
category: Usage
6
+
severity: Warning
7
+
v2: false
8
+
v3: true
9
+
---
10
+
11
+
## Cause
12
+
13
+
A violation of this rule occurs when creating a data source from `TheoryData<...>` which includes `ITheoryDataRow` (or any type which implements it).
14
+
15
+
## Reason for rule
16
+
17
+
`ITheoryDataRule` (and derived types, like `TheoryDataRule<...>`) are intended to be used directly from a collection, like `IEnumerable<>` or `List<>`.
18
+
19
+
## How to fix violations
20
+
21
+
To fix a violation of this rule, replace `TheoryData` with `IEnumeable` (or a standard generic collection).
0 commit comments