From 9e5c3912b6cfce0348aa2d88d30a11fe5b410e9c Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 10 Apr 2018 18:22:16 -0400 Subject: move mock classes out of sample code (#471) --- .../Mock/Netcode/NetFieldBase.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetFieldBase.cs (limited to 'src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetFieldBase.cs') diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetFieldBase.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetFieldBase.cs new file mode 100644 index 00000000..1684229a --- /dev/null +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetFieldBase.cs @@ -0,0 +1,16 @@ +// ReSharper disable CheckNamespace -- matches Stardew Valley's code +namespace Netcode +{ + /// A simplified version of Stardew Valley's Netcode.NetFieldBase for unit testing. + /// The type of the synchronised value. + /// The type of the current instance. + public class NetFieldBase where TSelf : NetFieldBase + { + /// The synchronised value. + public T Value { get; set; } + + /// Implicitly convert a net field to the its type. + /// The field to convert. + public static implicit operator T(NetFieldBase field) => field.Value; + } +} -- cgit