summaryrefslogtreecommitdiff
path: root/src/SMAPI.Tests.ModApiProvider/ProviderMod.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Tests.ModApiProvider/ProviderMod.cs')
-rw-r--r--src/SMAPI.Tests.ModApiProvider/ProviderMod.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/SMAPI.Tests.ModApiProvider/ProviderMod.cs b/src/SMAPI.Tests.ModApiProvider/ProviderMod.cs
new file mode 100644
index 00000000..c36e1c6d
--- /dev/null
+++ b/src/SMAPI.Tests.ModApiProvider/ProviderMod.cs
@@ -0,0 +1,38 @@
+using System.Collections.Generic;
+using System.Reflection;
+using SMAPI.Tests.ModApiProvider.Framework;
+
+namespace SMAPI.Tests.ModApiProvider
+{
+ /// <summary>A simulated mod instance.</summary>
+ public class ProviderMod
+ {
+ /// <summary>The underlying API instance.</summary>
+ private readonly SimpleApi Api = new();
+
+ /// <summary>Get the mod API instance.</summary>
+ public object GetModApi()
+ {
+ return this.Api;
+ }
+
+ /// <summary>Raise the <see cref="SimpleApi.OnEventRaised"/> event.</summary>
+ /// <param name="value">The value to send as an event argument.</param>
+ public void RaiseEvent(int value)
+ {
+ this.Api.RaiseEventField(value);
+ }
+
+ /// <summary>Set the values for the API property.</summary>
+ public void SetPropertyValues(int number, object obj, string listValue, string listWithInterfaceValue, string dictionaryKey, string dictionaryListValue, BindingFlags enumValue, string inheritedValue)
+ {
+ this.Api.NumberProperty = number;
+ this.Api.ObjectProperty = obj;
+ this.Api.ListProperty = new List<string> { listValue };
+ this.Api.ListPropertyWithInterface = new List<string> { listWithInterfaceValue };
+ this.Api.GenericsProperty = new Dictionary<string, IList<string>> { [dictionaryKey] = new List<string> { dictionaryListValue } };
+ this.Api.EnumProperty = enumValue;
+ this.Api.InheritedProperty = inheritedValue;
+ }
+ }
+}