@@ -26,14 +26,10 @@ public class AssertionDiagnosticAttribute : Attribute, ITestDataSource
26
26
{
27
27
public string Assertion { get ; }
28
28
29
- public bool Ignore { get ; }
30
-
31
- public AssertionDiagnosticAttribute ( string assertion , bool ignore = false ) => ( Assertion , Ignore ) = ( assertion , ignore ) ;
29
+ public AssertionDiagnosticAttribute ( string assertion ) => Assertion = assertion ;
32
30
33
31
public IEnumerable < object [ ] > GetData ( MethodInfo methodInfo )
34
32
{
35
- if ( Ignore ) yield break ;
36
-
37
33
foreach ( var assertion in TestCasesInputUtils . GetTestCases ( Assertion ) )
38
34
{
39
35
yield return new object [ ] { assertion } ;
@@ -43,20 +39,24 @@ public IEnumerable<object[]> GetData(MethodInfo methodInfo)
43
39
public string GetDisplayName ( MethodInfo methodInfo , object [ ] data ) => $ "{ methodInfo . Name } (\" { data [ 0 ] } \" )";
44
40
}
45
41
42
+ [ AttributeUsage ( AttributeTargets . Method , AllowMultiple = true ) ]
43
+ public class IgnoreAssertionDiagnosticAttribute : Attribute
44
+ {
45
+ public string Assertion { get ; }
46
+
47
+ public IgnoreAssertionDiagnosticAttribute ( string assertion ) => Assertion = assertion ;
48
+ }
49
+
46
50
[ AttributeUsage ( AttributeTargets . Method , AllowMultiple = true ) ]
47
51
public class AssertionCodeFixAttribute : Attribute , ITestDataSource
48
52
{
49
53
public string OldAssertion { get ; }
50
54
public string NewAssertion { get ; }
51
55
52
- public bool Ignore { get ; }
53
-
54
- public AssertionCodeFixAttribute ( string oldAssertion , string newAssertion , bool ignore = false ) => ( OldAssertion , NewAssertion , Ignore ) = ( oldAssertion , newAssertion , ignore ) ;
56
+ public AssertionCodeFixAttribute ( string oldAssertion , string newAssertion ) => ( OldAssertion , NewAssertion ) = ( oldAssertion , newAssertion ) ;
55
57
56
58
public IEnumerable < object [ ] > GetData ( MethodInfo methodInfo )
57
59
{
58
- if ( Ignore ) yield break ;
59
-
60
60
foreach ( var ( oldAssertion , newAssertion ) in TestCasesInputUtils . GetTestCases ( OldAssertion , NewAssertion ) )
61
61
{
62
62
yield return new object [ ] { oldAssertion , newAssertion } ;
@@ -66,22 +66,27 @@ public IEnumerable<object[]> GetData(MethodInfo methodInfo)
66
66
public string GetDisplayName ( MethodInfo methodInfo , object [ ] data ) => $ "{ methodInfo . Name } (\" old: { data [ 0 ] } \" , new: { data [ 1 ] } \" )";
67
67
}
68
68
69
+ [ AttributeUsage ( AttributeTargets . Method , AllowMultiple = true ) ]
70
+ public class IgnoreAssertionCodeFixAttribute : Attribute
71
+ {
72
+ public string OldAssertion { get ; }
73
+ public string NewAssertion { get ; }
74
+
75
+ public IgnoreAssertionCodeFixAttribute ( string oldAssertion , string newAssertion ) => ( OldAssertion , NewAssertion ) = ( oldAssertion , newAssertion ) ;
76
+ }
77
+
69
78
[ AttributeUsage ( AttributeTargets . Method , AllowMultiple = true ) ]
70
79
public class AssertionMethodCodeFixAttribute : Attribute , ITestDataSource
71
80
{
72
81
public string MethodArguments { get ; }
73
82
public string OldAssertion { get ; }
74
83
public string NewAssertion { get ; }
75
84
76
- public bool Ignore { get ; }
77
-
78
- public AssertionMethodCodeFixAttribute ( string methodArguments , string oldAssertion , string newAssertion , bool ignore = false )
79
- => ( MethodArguments , OldAssertion , NewAssertion , Ignore ) = ( methodArguments , oldAssertion , newAssertion , ignore ) ;
85
+ public AssertionMethodCodeFixAttribute ( string methodArguments , string oldAssertion , string newAssertion )
86
+ => ( MethodArguments , OldAssertion , NewAssertion ) = ( methodArguments , oldAssertion , newAssertion ) ;
80
87
81
88
public IEnumerable < object [ ] > GetData ( MethodInfo methodInfo )
82
89
{
83
- if ( Ignore ) yield break ;
84
-
85
90
foreach ( var ( oldAssertion , newAssertion ) in TestCasesInputUtils . GetTestCases ( OldAssertion , NewAssertion ) )
86
91
{
87
92
yield return new object [ ] { MethodArguments , oldAssertion , newAssertion } ;
@@ -91,6 +96,17 @@ public IEnumerable<object[]> GetData(MethodInfo methodInfo)
91
96
public string GetDisplayName ( MethodInfo methodInfo , object [ ] data ) => $ "{ methodInfo . Name } (\" arguments\" :{ data [ 0 ] } , \" old: { data [ 1 ] } \" , new: { data [ 2 ] } \" )";
92
97
}
93
98
99
+ [ AttributeUsage ( AttributeTargets . Method , AllowMultiple = true ) ]
100
+ public class IgnoreAssertionMethodCodeFixAttribute : Attribute
101
+ {
102
+ public string MethodArguments { get ; }
103
+ public string OldAssertion { get ; }
104
+ public string NewAssertion { get ; }
105
+
106
+ public IgnoreAssertionMethodCodeFixAttribute ( string methodArguments , string oldAssertion , string newAssertion )
107
+ => ( MethodArguments , OldAssertion , NewAssertion ) = ( methodArguments , oldAssertion , newAssertion ) ;
108
+ }
109
+
94
110
public static class TestCasesInputUtils
95
111
{
96
112
private static readonly string Empty = string . Empty ;
0 commit comments