summaryrefslogtreecommitdiff
path: root/src/SMAPI.Tests/Core/InterfaceProxyTests.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-12 20:52:01 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-12 20:52:01 -0400
commit5f7a92a74592a53529890eebb1ee9fe519afd92f (patch)
tree67c515794b8dcc7d4721adc3b2f239edd68f9009 /src/SMAPI.Tests/Core/InterfaceProxyTests.cs
parentc3851ae2e6c8fb286d4744612fbfea039d1baf7f (diff)
downloadSMAPI-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.cs12
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}'.");