diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-12 20:52:01 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-12 20:52:01 -0400 |
commit | 5f7a92a74592a53529890eebb1ee9fe519afd92f (patch) | |
tree | 67c515794b8dcc7d4721adc3b2f239edd68f9009 /src/SMAPI.Tests/Core/InterfaceProxyTests.cs | |
parent | c3851ae2e6c8fb286d4744612fbfea039d1baf7f (diff) | |
download | SMAPI-5f7a92a74592a53529890eebb1ee9fe519afd92f.tar.gz SMAPI-5f7a92a74592a53529890eebb1ee9fe519afd92f.tar.bz2 SMAPI-5f7a92a74592a53529890eebb1ee9fe519afd92f.zip |
enable nullable annotations in unit tests (#837)
Diffstat (limited to 'src/SMAPI.Tests/Core/InterfaceProxyTests.cs')
-rw-r--r-- | src/SMAPI.Tests/Core/InterfaceProxyTests.cs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/SMAPI.Tests/Core/InterfaceProxyTests.cs b/src/SMAPI.Tests/Core/InterfaceProxyTests.cs index 1bf2ed68..0b4919ed 100644 --- a/src/SMAPI.Tests/Core/InterfaceProxyTests.cs +++ b/src/SMAPI.Tests/Core/InterfaceProxyTests.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -41,7 +39,7 @@ namespace SMAPI.Tests.Core public void CanProxy_EventField() { // arrange - var providerMod = new ProviderMod(); + ProviderMod providerMod = new(); object implementation = providerMod.GetModApi(); int expectedValue = this.Random.Next(); @@ -61,7 +59,7 @@ namespace SMAPI.Tests.Core public void CanProxy_EventProperty() { // arrange - var providerMod = new ProviderMod(); + ProviderMod providerMod = new(); object implementation = providerMod.GetModApi(); int expectedValue = this.Random.Next(); @@ -86,7 +84,7 @@ namespace SMAPI.Tests.Core public void CanProxy_Properties(string setVia) { // arrange - var providerMod = new ProviderMod(); + ProviderMod providerMod = new(); object implementation = providerMod.GetModApi(); int expectedNumber = this.Random.Next(); int expectedObject = this.Random.Next(); @@ -317,13 +315,13 @@ namespace SMAPI.Tests.Core /// <summary>Get a property value from an instance.</summary> /// <param name="parent">The instance whose property to read.</param> /// <param name="name">The property name.</param> - private object GetPropertyValue(object parent, string name) + private object? GetPropertyValue(object parent, string name) { if (parent is null) throw new ArgumentNullException(nameof(parent)); Type type = parent.GetType(); - PropertyInfo property = type.GetProperty(name); + PropertyInfo? property = type.GetProperty(name); if (property is null) throw new InvalidOperationException($"The '{type.FullName}' type has no public property named '{name}'."); |