Skip to content

Commit 40c3dec

Browse files
committed
Simplify tests in TheoryMethodMustHaveTestDataTests
1 parent 357178d commit 40c3dec

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

src/xunit.analyzers.tests/Analyzers/X1000/TheoryMethodMustHaveTestDataTests.cs

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,37 @@ public class TheoryMethodMustHaveTestDataTests
88
public async Task FactMethod_DoesNotTrigger()
99
{
1010
var source = /* lang=c#-test */ """
11+
using Xunit;
12+
1113
public class TestClass {
12-
[Xunit.Fact]
14+
[Fact]
1315
public void TestMethod() { }
1416
}
1517
""";
1618

1719
await Verify.VerifyAnalyzer(source);
1820
}
1921

20-
[Theory]
21-
[InlineData("InlineData")]
22-
[InlineData("MemberData(\"\")")]
23-
[InlineData("ClassData(typeof(string))")]
24-
public async Task TheoryMethodWithDataAttributes_DoesNotTrigger(string dataAttribute)
22+
[Fact]
23+
public async Task TheoryMethodWithDataAttributes_DoesNotTrigger()
2524
{
26-
var source = string.Format(/* lang=c#-test */ """
27-
public class TestClass {{
28-
[Xunit.Theory]
29-
[Xunit.{0}]
30-
public void TestMethod() {{ }}
31-
}}
32-
""", dataAttribute);
25+
var source = /* lang=c#-test */ """
26+
using Xunit;
27+
28+
public class TestClass {
29+
[Theory]
30+
[InlineData]
31+
public void TestMethod1() { }
32+
33+
[Theory]
34+
[MemberData("")]
35+
public void TestMethod2() { }
36+
37+
[Theory]
38+
[ClassData(typeof(string))]
39+
public void TestMethod3() { }
40+
}
41+
""";
3342

3443
await Verify.VerifyAnalyzer(source);
3544
}
@@ -38,8 +47,10 @@ public void TestMethod() {{ }}
3847
public async Task TheoryMethodMissingData_Triggers()
3948
{
4049
var source = /* lang=c#-test */ """
50+
using Xunit;
51+
4152
class TestClass {
42-
[Xunit.Theory]
53+
[Theory]
4354
public void [|TestMethod|]() { }
4455
}
4556
""";

0 commit comments

Comments
 (0)