@@ -127,6 +127,7 @@ public class Generic<T>
127
127
}
128
128
129
129
[ Test ]
130
+ // ReSharper disable once InconsistentNaming
130
131
public void IEnumeratorGetCurrent ( )
131
132
{
132
133
var testCode = @"
@@ -145,6 +146,54 @@ public void Meh(object value)
145
146
AnalyzerAssert . Valid ( Analyzer , testCode ) ;
146
147
}
147
148
149
+ [ TestCase ( "GetMethod(\" add_Public\" )" ) ]
150
+ [ TestCase ( "GetMethod(\" remove_Public\" )" ) ]
151
+ public void EventAccessors ( string before )
152
+ {
153
+ var code = @"
154
+ namespace RoslynSandbox
155
+ {
156
+ using System;
157
+ using System.Reflection;
158
+
159
+ class Foo
160
+ {
161
+ public Foo()
162
+ {
163
+ var methodInfo = typeof(Foo).GetMethod(""add_Public"");
164
+ }
165
+
166
+ public event EventHandler Public;
167
+ }
168
+ }" . AssertReplace ( "GetMethod(\" add_Public\" )" , before ) ;
169
+
170
+ AnalyzerAssert . Valid ( Analyzer , ExpectedDiagnostic , code ) ;
171
+ }
172
+
173
+ [ TestCase ( "GetMethod(\" get_Public\" )" ) ]
174
+ [ TestCase ( "GetMethod(\" set_Public\" )" ) ]
175
+ public void PropertyAccessors ( string before )
176
+ {
177
+ var code = @"
178
+ namespace RoslynSandbox
179
+ {
180
+ using System;
181
+ using System.Reflection;
182
+
183
+ class Foo
184
+ {
185
+ public Foo()
186
+ {
187
+ var methodInfo = typeof(Foo).GetMethod(""get_Public"");
188
+ }
189
+
190
+ public int Public { get; set; }
191
+ }
192
+ }" . AssertReplace ( "GetMethod(\" get_Public\" )" , before ) ;
193
+
194
+ AnalyzerAssert . Valid ( Analyzer , ExpectedDiagnostic , code ) ;
195
+ }
196
+
148
197
[ Test ]
149
198
public void WhenThrowingArgumentException ( )
150
199
{
0 commit comments