Skip to content

Commit e9e2c4b

Browse files
committed
Annotate test code.
1 parent b5b55fd commit e9e2c4b

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

PropertyChangedAnalyzers.Test/INPC014PreferSettingBackingFieldInCtor/CodeFix.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ public class C
237237
238238
public C(int value)
239239
{
240+
#pragma warning disable CS0219
240241
var p = 1;
241242
↓this.P = value;
242243
}
@@ -258,6 +259,7 @@ public class C
258259
259260
public C(int value)
260261
{
262+
#pragma warning disable CS0219
261263
var p = 1;
262264
this.p = value;
263265
}

PropertyChangedAnalyzers.Test/INPC014PreferSettingBackingFieldInCtor/Valid.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ namespace N
247247
248248
public class C : INotifyPropertyChanged
249249
{
250-
private string p;
250+
private string? p;
251251
252252
public event PropertyChangedEventHandler? PropertyChanged;
253253
@@ -256,7 +256,7 @@ public C(string p)
256256
this.PropertyChanged += (_, __) => this.P = p;
257257
}
258258
259-
public string P
259+
public string? P
260260
{
261261
get => this.p;
262262
private set
@@ -291,18 +291,18 @@ namespace N
291291
292292
public class C : INotifyPropertyChanged
293293
{
294-
private string p;
294+
private string? p;
295295
296296
public event PropertyChangedEventHandler? PropertyChanged;
297297
298298
public C(string p)
299299
{
300-
void OnChanged(object _, PropertyChangedEventArgs __) => this.P = p;
300+
void OnChanged(object? _, PropertyChangedEventArgs __) => this.P = p;
301301
302302
this.PropertyChanged += OnChanged;
303303
}
304304
305-
public string P
305+
public string? P
306306
{
307307
get => this.p;
308308
private set

PropertyChangedAnalyzers.Test/INPC015PropertyIsRecursive/Diagnostics.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace PropertyChangedAnalyzers.Test.INPC015PropertyIsRecursive
1+
namespace PropertyChangedAnalyzers.Test.INPC015PropertyIsRecursive
22
{
33
using Gu.Roslyn.Asserts;
44
using NUnit.Framework;
@@ -67,7 +67,7 @@ namespace N
6767
{
6868
public class C
6969
{
70-
private int p;
70+
private int p = 1;
7171
7272
public int P
7373
{
@@ -88,7 +88,7 @@ namespace N
8888
{
8989
public class C
9090
{
91-
private int p;
91+
private int p = 1;
9292
9393
public int P
9494
{

0 commit comments

Comments
 (0)