Skip to content

Commit 2a9cb1d

Browse files
committed
Fix nullability warnings in test projects
1 parent 0ae8bb7 commit 2a9cb1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/CommunityToolkit.Mvvm.UnitTests/Test_ObservablePropertyAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,11 +958,11 @@ public void Test_ObservableProperty_CommandNamesThatCantBeLowered()
958958

959959
FieldInfo? fieldInfo = typeof(ModelWithCommandNamesThatCantBeLowered).GetField($"_{nameof(ModelWithCommandNamesThatCantBeLowered.中文)}Command", BindingFlags.Instance | BindingFlags.NonPublic);
960960

961-
Assert.AreSame(model.中文Command, fieldInfo.GetValue(model));
961+
Assert.AreSame(model.中文Command, fieldInfo?.GetValue(model));
962962

963963
fieldInfo = typeof(ModelWithCommandNamesThatCantBeLowered).GetField($"_{nameof(ModelWithCommandNamesThatCantBeLowered.c中文)}Command", BindingFlags.Instance | BindingFlags.NonPublic);
964964

965-
Assert.AreSame(model.c中文Command, fieldInfo.GetValue(model));
965+
Assert.AreSame(model.c中文Command, fieldInfo?.GetValue(model));
966966
}
967967

968968
public abstract partial class BaseViewModel : ObservableObject

0 commit comments

Comments
 (0)