模块参数功能 (#4)

#3

Reviewed-on: jackfiled/Katheryne#4
This commit is contained in:
2023-10-30 22:25:20 +08:00
parent 52ede9fe96
commit 8e9df3fc52
9 changed files with 162 additions and 16 deletions

View File

@@ -0,0 +1,34 @@
using Katheryne.Abstractions;
namespace Katheryne.Tests.Mocks;
public class MockParamModule : IParamsModule
{
private readonly Dictionary<string, Func<string>> _functions = new();
public string ModuleName => "test";
public MockParamModule()
{
_functions.Add("hello", Hello);
}
public string this[string param]
{
get
{
Func<string> func = _functions[param];
return func();
}
}
public bool ContainsParam(string param)
{
return _functions.ContainsKey(param);
}
private string Hello()
{
return "Hello, Katheryne";
}
}