Skip to content

Commit f929630

Browse files
committed
Fix tests.
1 parent 26a952a commit f929630

6 files changed

Lines changed: 44 additions & 5 deletions

File tree

ValidCode/Interfaces/Generic.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public T Value
3131
{
3232
get => this.value;
3333
#pragma warning disable CS8601 // Possible null reference assignment.
34-
set => this.Value = (T)value;
34+
set => this.Value = (T?)value;
3535
#pragma warning restore CS8601 // Possible null reference assignment.
3636
}
3737

ValidCode/Interfaces/GenericAutoProperty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public T Value
3131
{
3232
get => this.Value;
3333
#pragma warning disable CS8601 // Possible null reference assignment.
34-
set => this.Value = (T)value;
34+
set => this.Value = (T?)value;
3535
#pragma warning restore CS8601 // Possible null reference assignment.
3636
}
3737

ValidCode/Interfaces/GenericClass.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public T Value
3131
{
3232
get => this.value;
3333
#pragma warning disable CS8601 // Possible null reference assignment.
34-
set => this.Value = (T)value;
34+
set => this.Value = (T?)value;
3535
#pragma warning restore CS8601 // Possible null reference assignment.
3636
}
3737

ValidCode/Recursion/StatementBodies.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#pragma warning disable INPC007, INPC015, INPC020, CS0067
33
namespace ValidCode.Recursion
44
{
5-
using System.Collections.Generic;
65
using System.ComponentModel;
76
using System.Runtime.CompilerServices;
87

ValidCode/WithEventDeclaration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public sealed class WithEventDeclaration : INotifyPropertyChanged
99
{
1010
private string? name;
1111

12-
public event PropertyChangedEventHandler PropertyChanged
12+
public event PropertyChangedEventHandler? PropertyChanged
1313
{
1414
add => this.propertyChanged += value;
1515
remove => this.propertyChanged -= value;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#nullable disable
2+
namespace ValidCode
3+
{
4+
using System.ComponentModel;
5+
using System.Runtime.CompilerServices;
6+
7+
public sealed class WithEventDeclarationNullableDisabled : INotifyPropertyChanged
8+
{
9+
private string name;
10+
11+
public event PropertyChangedEventHandler PropertyChanged
12+
{
13+
add => this.propertyChanged += value;
14+
remove => this.propertyChanged -= value;
15+
}
16+
17+
private event PropertyChangedEventHandler propertyChanged;
18+
19+
public string Name
20+
{
21+
get => this.name;
22+
23+
set
24+
{
25+
if (value == this.name)
26+
{
27+
return;
28+
}
29+
30+
this.name = value;
31+
this.OnPropertyChanged();
32+
}
33+
}
34+
35+
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
36+
{
37+
this.propertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)