From 3064b58719060a145058ab295792d8c97128b433 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 10 Feb 2022 22:03:09 -0500 Subject: add basic unit tests for API interface proxying --- .../Interfaces/ISimpleApi.cs | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/SMAPI.Tests.ModApiConsumer/Interfaces/ISimpleApi.cs (limited to 'src/SMAPI.Tests.ModApiConsumer/Interfaces') diff --git a/src/SMAPI.Tests.ModApiConsumer/Interfaces/ISimpleApi.cs b/src/SMAPI.Tests.ModApiConsumer/Interfaces/ISimpleApi.cs new file mode 100644 index 00000000..7f94e137 --- /dev/null +++ b/src/SMAPI.Tests.ModApiConsumer/Interfaces/ISimpleApi.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + +namespace SMAPI.Tests.ModApiConsumer.Interfaces +{ + /// A mod-provided API which provides basic events, properties, and methods. + public interface ISimpleApi + { + /********* + ** Test interface + *********/ + /**** + ** Events + ****/ + /// A simple event field. + event EventHandler OnEventRaised; + + /// A simple event property with custom add/remove logic. + event EventHandler OnEventRaisedProperty; + + + /**** + ** Properties + ****/ + /// A simple numeric property. + int NumberProperty { get; set; } + + /// A simple object property. + object ObjectProperty { get; set; } + + /// A simple list property. + List ListProperty { get; set; } + + /// A simple list property with an interface. + IList ListPropertyWithInterface { get; set; } + + /// A property with nested generics. + IDictionary> GenericsProperty { get; set; } + + /// A property using an enum available to both mods. + BindingFlags EnumProperty { get; set; } + + /// A read-only property. + int GetterProperty { get; } + + + /**** + ** Methods + ****/ + /// A simple method with no return value. + void GetNothing(); + + /// A simple method which returns a number. + int GetInt(int value); + + /// A simple method which returns an object. + object GetObject(object value); + + /// A simple method which returns a list. + List GetList(string value); + + /// A simple method which returns a list with an interface. + IList GetListWithInterface(string value); + + /// A simple method which returns nested generics. + IDictionary> GetGenerics(string key, string value); + + /// A simple method which returns a lambda. + Func GetLambda(Func value); + + + /**** + ** Inherited members + ****/ + /// A property inherited from a base class. + public string InheritedProperty { get; set; } + } +} -- cgit