Skip to content

Commit c8bb859

Browse files
committed
Annotate test code.
1 parent 4661bed commit c8bb859

2 files changed

Lines changed: 39 additions & 41 deletions

File tree

PropertyChangedAnalyzers.Test/INPC002MutablePublicPropertyShouldNotify/Valid.MvvmCrossCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public int P
5252
RoslynAssert.Valid(Analyzer, code, settings: Settings);
5353
}
5454

55-
[TestCase("(string)null")]
55+
[TestCase("(string?)null")]
5656
[TestCase("string.Empty")]
5757
[TestCase(@"""P""")]
5858
[TestCase(@"nameof(P)")]

PropertyChangedAnalyzers.Test/INPC003NotifyForDependentProperty/CodeFix.cs

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ namespace N
9898
9999
public class C : INotifyPropertyChanged
100100
{
101-
private static readonly int Two = 2;
102101
private int _p;
103102
104103
public event PropertyChangedEventHandler? PropertyChanged;
@@ -125,7 +124,6 @@ namespace N
125124
126125
public class C : INotifyPropertyChanged
127126
{
128-
private static readonly int Two = 2;
129127
private int _p;
130128
131129
public event PropertyChangedEventHandler? PropertyChanged;
@@ -959,8 +957,8 @@ namespace N
959957
960958
public class C : INotifyPropertyChanged
961959
{
962-
private string firstName;
963-
private string lastName;
960+
private string? firstName;
961+
private string? lastName;
964962
965963
public event PropertyChangedEventHandler? PropertyChanged;
966964
@@ -974,7 +972,7 @@ public string FullName
974972
}
975973
}
976974
977-
public string FirstName
975+
public string? FirstName
978976
{
979977
get
980978
{
@@ -994,7 +992,7 @@ public string FirstName
994992
}
995993
}
996994
997-
public string LastName
995+
public string? LastName
998996
{
999997
get
1000998
{
@@ -1032,8 +1030,8 @@ namespace N
10321030
10331031
public class C : INotifyPropertyChanged
10341032
{
1035-
private string firstName;
1036-
private string lastName;
1033+
private string? firstName;
1034+
private string? lastName;
10371035
10381036
public event PropertyChangedEventHandler? PropertyChanged;
10391037
@@ -1047,7 +1045,7 @@ public string FullName
10471045
}
10481046
}
10491047
1050-
public string FirstName
1048+
public string? FirstName
10511049
{
10521050
get
10531051
{
@@ -1068,7 +1066,7 @@ public string FirstName
10681066
}
10691067
}
10701068
1071-
public string LastName
1069+
public string? LastName
10721070
{
10731071
get
10741072
{
@@ -1785,13 +1783,13 @@ namespace N
17851783
17861784
public class C : INotifyPropertyChanged
17871785
{
1788-
private string p;
1786+
private string? p;
17891787
17901788
public event PropertyChangedEventHandler? PropertyChanged;
17911789
1792-
public string CapsName => this.p.ToUpper();
1790+
public string? CapsName => this.p?.ToUpper();
17931791
1794-
public string P
1792+
public string? P
17951793
{
17961794
get
17971795
{
@@ -1825,13 +1823,13 @@ namespace N
18251823
18261824
public class C : INotifyPropertyChanged
18271825
{
1828-
private string p;
1826+
private string? p;
18291827
18301828
public event PropertyChangedEventHandler? PropertyChanged;
18311829
1832-
public string CapsName => this.p.ToUpper();
1830+
public string? CapsName => this.p?.ToUpper();
18331831
1834-
public string P
1832+
public string? P
18351833
{
18361834
get
18371835
{
@@ -2793,9 +2791,9 @@ namespace N.Client
27932791
27942792
public class C : N.Core.ViewModelBase
27952793
{
2796-
private string text;
2794+
private string? text;
27972795
2798-
public string Text => this.text;
2796+
public string? Text => this.text;
27992797
28002798
public void Update(string text)
28012799
{
@@ -2812,9 +2810,9 @@ namespace N.Client
28122810
28132811
public class C : N.Core.ViewModelBase
28142812
{
2815-
private string text;
2813+
private string? text;
28162814
2817-
public string Text => this.text;
2815+
public string? Text => this.text;
28182816
28192817
public void Update(string text)
28202818
{
@@ -2839,7 +2837,7 @@ namespace N
28392837
28402838
public class C : INotifyPropertyChanged
28412839
{
2842-
private string p;
2840+
private string? p;
28432841
28442842
public C()
28452843
{
@@ -2848,7 +2846,7 @@ public C()
28482846
28492847
public event PropertyChangedEventHandler? PropertyChanged;
28502848
2851-
public string P => this.p;
2849+
public string? P => this.p;
28522850
28532851
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
28542852
{
@@ -2866,7 +2864,7 @@ namespace N
28662864
28672865
public class C : INotifyPropertyChanged
28682866
{
2869-
private string p;
2867+
private string? p;
28702868
28712869
public C()
28722870
{
@@ -2879,7 +2877,7 @@ public C()
28792877
28802878
public event PropertyChangedEventHandler? PropertyChanged;
28812879
2882-
public string P => this.p;
2880+
public string? P => this.p;
28832881
28842882
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
28852883
{
@@ -2903,7 +2901,7 @@ namespace N
29032901
29042902
public class C : INotifyPropertyChanged
29052903
{
2906-
private string p;
2904+
private string? p;
29072905
29082906
public C()
29092907
{
@@ -2915,7 +2913,7 @@ public C()
29152913
29162914
public event PropertyChangedEventHandler? PropertyChanged;
29172915
2918-
public string P => this.p;
2916+
public string? P => this.p;
29192917
29202918
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
29212919
{
@@ -2933,7 +2931,7 @@ namespace N
29332931
29342932
public class C : INotifyPropertyChanged
29352933
{
2936-
private string p;
2934+
private string? p;
29372935
29382936
public C()
29392937
{
@@ -2946,7 +2944,7 @@ public C()
29462944
29472945
public event PropertyChangedEventHandler? PropertyChanged;
29482946
2949-
public string P => this.p;
2947+
public string? P => this.p;
29502948
29512949
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
29522950
{
@@ -2969,7 +2967,7 @@ namespace N
29692967
29702968
public class C : INotifyPropertyChanged
29712969
{
2972-
private string p;
2970+
private string? p;
29732971
29742972
public C()
29752973
{
@@ -2978,7 +2976,7 @@ public C()
29782976
29792977
public event PropertyChangedEventHandler? PropertyChanged;
29802978
2981-
public string P => this.p;
2979+
public string? P => this.p;
29822980
29832981
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
29842982
{
@@ -2995,7 +2993,7 @@ namespace N
29952993
29962994
public class C : INotifyPropertyChanged
29972995
{
2998-
private string p;
2996+
private string? p;
29992997
30002998
public C()
30012999
{
@@ -3008,7 +3006,7 @@ public C()
30083006
30093007
public event PropertyChangedEventHandler? PropertyChanged;
30103008
3011-
public string P => this.p;
3009+
public string? P => this.p;
30123010
30133011
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
30143012
{
@@ -3031,7 +3029,7 @@ namespace N
30313029
30323030
public class C : INotifyPropertyChanged
30333031
{
3034-
private string p;
3032+
private string? p;
30353033
30363034
public C()
30373035
{
@@ -3043,7 +3041,7 @@ public C()
30433041
30443042
public event PropertyChangedEventHandler? PropertyChanged;
30453043
3046-
public string P => this.p;
3044+
public string? P => this.p;
30473045
30483046
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
30493047
{
@@ -3060,7 +3058,7 @@ namespace N
30603058
30613059
public class C : INotifyPropertyChanged
30623060
{
3063-
private string p;
3061+
private string? p;
30643062
30653063
public C()
30663064
{
@@ -3073,7 +3071,7 @@ public C()
30733071
30743072
public event PropertyChangedEventHandler? PropertyChanged;
30753073
3076-
public string P => this.p;
3074+
public string? P => this.p;
30773075
30783076
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
30793077
{
@@ -3096,14 +3094,14 @@ namespace N
30963094
30973095
public class C : INotifyPropertyChanged
30983096
{
3099-
private string p;
3097+
private int p = 1;
31003098
private int getCount;
31013099
31023100
public event PropertyChangedEventHandler? PropertyChanged;
31033101
31043102
public int GetCount => this.getCount;
31053103
3106-
public string P
3104+
public int P
31073105
{
31083106
get
31093107
{
@@ -3127,14 +3125,14 @@ namespace N
31273125
31283126
public class C : INotifyPropertyChanged
31293127
{
3130-
private string p;
3128+
private int p = 1;
31313129
private int getCount;
31323130
31333131
public event PropertyChangedEventHandler? PropertyChanged;
31343132
31353133
public int GetCount => this.getCount;
31363134
3137-
public string P
3135+
public int P
31383136
{
31393137
get
31403138
{

0 commit comments

Comments
 (0)