Skip to content

Commit de99de3

Browse files
committed
Annotate test code.
1 parent acb0181 commit de99de3

3 files changed

Lines changed: 62 additions & 44 deletions

File tree

PropertyChangedAnalyzers.Test/INPC005CheckIfDifferentBeforeNotifying/CodeFix.WhenCheck.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ namespace N
2121
2222
public class C : INotifyPropertyChanged
2323
{
24-
private string p2;
24+
private int p2;
2525
2626
public event PropertyChangedEventHandler? PropertyChanged;
2727
2828
public string P1 => $""Hello {this.p2}"";
2929
30-
public string P2
30+
public int P2
3131
{
3232
get { return this.p2; }
3333
set
@@ -67,13 +67,13 @@ namespace N
6767
6868
public class C : INotifyPropertyChanged
6969
{
70-
private string p2;
70+
private int p2;
7171
7272
public event PropertyChangedEventHandler? PropertyChanged;
7373
7474
public string P1 => $""Hello {this.p2}"";
7575
76-
public string P2
76+
public int P2
7777
{
7878
get { return this.p2; }
7979
set
@@ -119,13 +119,13 @@ namespace N
119119
120120
public class C : INotifyPropertyChanged
121121
{
122-
private string p2;
122+
private int p2;
123123
124124
public event PropertyChangedEventHandler? PropertyChanged;
125125
126126
public string P1 => $""Hello {this.p2}"";
127127
128-
public string P2
128+
public int P2
129129
{
130130
get => this.p2;
131131
set
@@ -164,13 +164,13 @@ namespace N
164164
165165
public class C : INotifyPropertyChanged
166166
{
167-
private string p2;
167+
private int p2;
168168
169169
public event PropertyChangedEventHandler? PropertyChanged;
170170
171171
public string P1 => $""Hello {this.p2}"";
172172
173-
public string P2
173+
public int P2
174174
{
175175
get => this.p2;
176176
set
@@ -219,13 +219,13 @@ namespace N
219219
220220
public class C : INotifyPropertyChanged
221221
{
222-
private string p2;
222+
private int p2;
223223
224224
public event PropertyChangedEventHandler? PropertyChanged;
225225
226226
public string P1 => $""Hello {this.p2}"";
227227
228-
public string P2
228+
public int P2
229229
{
230230
get { return this.p2; }
231231
set
@@ -268,13 +268,13 @@ namespace N
268268
269269
public class C : INotifyPropertyChanged
270270
{
271-
private string p2;
271+
private int p2;
272272
273273
public event PropertyChangedEventHandler? PropertyChanged;
274274
275275
public string P1 => $""Hello {this.p2}"";
276276
277-
public string P2
277+
public int P2
278278
{
279279
get { return this.p2; }
280280
set
@@ -322,15 +322,15 @@ namespace N
322322
323323
public class C : INotifyPropertyChanged
324324
{
325-
private string p3;
325+
private int p3;
326326
327327
public event PropertyChangedEventHandler? PropertyChanged;
328328
329329
public string P1 => $""Hello {this.p3}"";
330330
331331
public string P2 => $""Hello {this.p3}"";
332332
333-
public string P3
333+
public int P3
334334
{
335335
get { return this.p3; }
336336
set
@@ -374,15 +374,15 @@ namespace N
374374
375375
public class C : INotifyPropertyChanged
376376
{
377-
private string p3;
377+
private int p3;
378378
379379
public event PropertyChangedEventHandler? PropertyChanged;
380380
381381
public string P1 => $""Hello {this.p3}"";
382382
383383
public string P2 => $""Hello {this.p3}"";
384384
385-
public string P3
385+
public int P3
386386
{
387387
get { return this.p3; }
388388
set
@@ -431,15 +431,15 @@ namespace N
431431
432432
public class C : INotifyPropertyChanged
433433
{
434-
private string p3;
434+
private int p3;
435435
436436
public event PropertyChangedEventHandler? PropertyChanged;
437437
438438
public string P1 => $""Hello {this.p3}"";
439439
440440
public string P2 => $""Hello {this.p3}"";
441441
442-
public string P3
442+
public int P3
443443
{
444444
get { return this.p3; }
445445
set
@@ -481,15 +481,15 @@ namespace N
481481
482482
public class C : INotifyPropertyChanged
483483
{
484-
private string p3;
484+
private int p3;
485485
486486
public event PropertyChangedEventHandler? PropertyChanged;
487487
488488
public string P1 => $""Hello {this.p3}"";
489489
490490
public string P2 => $""Hello {this.p3}"";
491491
492-
public string P3
492+
public int P3
493493
{
494494
get { return this.p3; }
495495
set

PropertyChangedAnalyzers.Test/INPC005CheckIfDifferentBeforeNotifying/CodeFix.WhenNoCheck.cs

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ public int P
318318
set
319319
{
320320
this.p = value;
321+
#pragma warning disable CS8602
321322
↓this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(this.P)));
322323
}
323324
}
@@ -351,6 +352,7 @@ public int P
351352
}
352353
353354
this.p = value;
355+
#pragma warning disable CS8602
354356
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(this.P)));
355357
}
356358
}
@@ -380,6 +382,7 @@ public static int P
380382
set
381383
{
382384
p = value;
385+
#pragma warning disable CS8602
383386
↓PropertyChanged.Invoke(null, new PropertyChangedEventArgs(nameof(P)));
384387
}
385388
}
@@ -408,6 +411,7 @@ public static int P
408411
}
409412
410413
p = value;
414+
#pragma warning disable CS8602
411415
PropertyChanged.Invoke(null, new PropertyChangedEventArgs(nameof(P)));
412416
}
413417
}
@@ -442,6 +446,7 @@ public int P
442446
set
443447
{
444448
_p = value;
449+
#pragma warning disable CS8602
445450
↓PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(P)));
446451
}
447452
}
@@ -475,6 +480,7 @@ public int P
475480
}
476481
477482
_p = value;
483+
#pragma warning disable CS8602
478484
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(P)));
479485
}
480486
}
@@ -510,6 +516,7 @@ public int P
510516
set
511517
{
512518
this.p = value;
519+
#pragma warning disable CS8602
513520
↓this.PropertyChanged.Invoke(this, ValuePropertyChangedEventArgs);
514521
}
515522
}
@@ -544,6 +551,7 @@ public int P
544551
}
545552
546553
this.p = value;
554+
#pragma warning disable CS8602
547555
this.PropertyChanged.Invoke(this, ValuePropertyChangedEventArgs);
548556
}
549557
}
@@ -578,6 +586,7 @@ public int P
578586
set
579587
{
580588
this.p = value;
589+
#pragma warning disable CS8602
581590
↓this.PropertyChanged(this, new PropertyChangedEventArgs(nameof(P)));
582591
}
583592
}
@@ -611,6 +620,7 @@ public int P
611620
}
612621
613622
this.p = value;
623+
#pragma warning disable CS8602
614624
this.PropertyChanged(this, new PropertyChangedEventArgs(nameof(P)));
615625
}
616626
}
@@ -640,6 +650,7 @@ namespace N
640650
public class C : INotifyPropertyChanged
641651
{
642652
private readonly C1 c1 = new C1();
653+
643654
public event PropertyChangedEventHandler? PropertyChanged;
644655
645656
public int P
@@ -667,6 +678,7 @@ namespace N
667678
public class C : INotifyPropertyChanged
668679
{
669680
private readonly C1 c1 = new C1();
681+
670682
public event PropertyChangedEventHandler? PropertyChanged;
671683
672684
public int P
@@ -707,11 +719,11 @@ namespace N
707719
708720
public class C : INotifyPropertyChanged
709721
{
710-
private string p;
722+
private int p;
711723
712724
public event PropertyChangedEventHandler? PropertyChanged;
713725
714-
public string P
726+
public int P
715727
{
716728
get => this.p;
717729
set
@@ -750,11 +762,11 @@ namespace N
750762
751763
public class C : INotifyPropertyChanged
752764
{
753-
private string p;
765+
private int p;
754766
755767
public event PropertyChangedEventHandler? PropertyChanged;
756768
757-
public string P
769+
public int P
758770
{
759771
get => this.p;
760772
set => this.TrySet(ref this.p, value);
@@ -796,13 +808,13 @@ namespace N
796808
797809
public class C : INotifyPropertyChanged
798810
{
799-
private string p2;
811+
private int p2;
800812
801813
public event PropertyChangedEventHandler? PropertyChanged;
802814
803815
public string P1 => $""Hello {this.p2}"";
804816
805-
public string P2
817+
public int P2
806818
{
807819
get => this.p2;
808820
set
@@ -841,13 +853,13 @@ namespace N
841853
842854
public class C : INotifyPropertyChanged
843855
{
844-
private string p2;
856+
private int p2;
845857
846858
public event PropertyChangedEventHandler? PropertyChanged;
847859
848860
public string P1 => $""Hello {this.p2}"";
849861
850-
public string P2
862+
public int P2
851863
{
852864
get => this.p2;
853865
set
@@ -891,11 +903,11 @@ namespace N
891903
892904
public class C : INotifyPropertyChanged
893905
{
894-
private string p;
906+
private int p;
895907
896908
public event PropertyChangedEventHandler? PropertyChanged;
897909
898-
public string P
910+
public int P
899911
{
900912
get => this.p;
901913
set
@@ -932,11 +944,11 @@ namespace N
932944
933945
public class C : INotifyPropertyChanged
934946
{
935-
private string p;
947+
private int p;
936948
937949
public event PropertyChangedEventHandler? PropertyChanged;
938950
939-
public string P
951+
public int P
940952
{
941953
get => this.p;
942954
set => this.TrySet(ref this.p, value, nameof(this.P));
@@ -975,11 +987,11 @@ namespace N
975987
976988
public class C : INotifyPropertyChanged
977989
{
978-
private string _p;
990+
private int _p;
979991
980992
public event PropertyChangedEventHandler? PropertyChanged;
981993
982-
public string P
994+
public int P
983995
{
984996
get => _p;
985997
set
@@ -1016,11 +1028,11 @@ namespace N
10161028
10171029
public class C : INotifyPropertyChanged
10181030
{
1019-
private string _p;
1031+
private int _p;
10201032
10211033
public event PropertyChangedEventHandler? PropertyChanged;
10221034
1023-
public string P
1035+
public int P
10241036
{
10251037
get => _p;
10261038
set => TrySet(ref _p, value, nameof(P));

0 commit comments

Comments
 (0)