diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-04-14 20:14:31 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-04-14 20:14:31 -0400 |
commit | 1848abe7d57e32207db9535c9c83d96dbda64ced (patch) | |
tree | 64d4137e14e7fe7c09584289d5b5581fc34749ff /src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock | |
parent | 6d8cf614a24ab69baffa89c351b9a22776741442 (diff) | |
download | SMAPI-1848abe7d57e32207db9535c9c83d96dbda64ced.tar.gz SMAPI-1848abe7d57e32207db9535c9c83d96dbda64ced.tar.bz2 SMAPI-1848abe7d57e32207db9535c9c83d96dbda64ced.zip |
don't warn for NetCollection conversion to implemented interface (#471)
Diffstat (limited to 'src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock')
3 files changed, 19 insertions, 7 deletions
diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetCollection.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetCollection.cs new file mode 100644 index 00000000..d160610e --- /dev/null +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetCollection.cs @@ -0,0 +1,10 @@ +// ReSharper disable CheckNamespace -- matches Stardew Valley's code +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Netcode +{ + /// <summary>A simplified version of Stardew Valley's <c>Netcode.NetCollection</c> for unit testing.</summary> + public class NetCollection<T> : Collection<T>, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable { } +} diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Farmer.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Farmer.cs index 54e91682..13fab069 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Farmer.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Farmer.cs @@ -1,7 +1,6 @@ // ReSharper disable CheckNamespace, InconsistentNaming -- matches Stardew Valley's code #pragma warning disable 649 // (never assigned) -- only used to test type conversions using System.Collections.Generic; -using Netcode; namespace StardewValley { @@ -10,11 +9,5 @@ namespace StardewValley { /// <summary>A sample field which should be replaced with a different property.</summary> public readonly IDictionary<string, int[]> friendships; - - /// <summary>A sample net list.</summary> - public readonly NetList<int> eventsSeen; - - /// <summary>A sample net object list.</summary> - public readonly NetObjectList<int> netObjectList; } } diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Item.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Item.cs index 386767d7..1b6317c1 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Item.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Item.cs @@ -20,5 +20,14 @@ namespace StardewValley /// <summary>A generic net ref property with no equivalent non-net property.</summary> public NetRef<object> netRefProperty { get; } = new NetRef<object>(); + + /// <summary>A sample net list.</summary> + public readonly NetList<int> netList = new NetList<int>(); + + /// <summary>A sample net object list.</summary> + public readonly NetObjectList<int> netObjectList = new NetObjectList<int>(); + + /// <summary>A sample net collection.</summary> + public readonly NetCollection<int> netCollection = new NetCollection<int>(); } } |