2021-05-30 23:13:46 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
|
|
|
|
|
namespace SKIT.FlurlHttpClient.Wechat.Work.UnitTests
|
|
|
|
|
{
|
|
|
|
|
class TestConfigs
|
|
|
|
|
{
|
|
|
|
|
static TestConfigs()
|
|
|
|
|
{
|
2021-08-05 17:57:13 +08:00
|
|
|
|
// NOTICE: 请在项目根目录下按照 appsettings.json 的格式填入测试参数。
|
2021-05-30 23:13:46 +08:00
|
|
|
|
// WARN: 敏感信息请不要提交到 git!
|
|
|
|
|
|
2021-08-05 17:57:13 +08:00
|
|
|
|
using var stream = File.OpenRead("appsettings.json");
|
2021-05-30 23:13:46 +08:00
|
|
|
|
using var json = JsonDocument.Parse(stream);
|
2021-06-07 11:18:27 +08:00
|
|
|
|
|
2021-05-30 23:13:46 +08:00
|
|
|
|
var config = json.RootElement.GetProperty("WechatConfig");
|
|
|
|
|
WechatCorpId = config.GetProperty("CorpId").GetString();
|
|
|
|
|
WechatAgentId = int.Parse(config.GetProperty("AgentId").GetString());
|
|
|
|
|
WechatAgentSecret = config.GetProperty("AgentSecret").GetString();
|
2021-06-07 11:18:27 +08:00
|
|
|
|
|
|
|
|
|
ProjectSourceDirectory = json.RootElement.GetProperty("ProjectSourceDirectory").GetString();
|
|
|
|
|
ProjectTestDirectory = json.RootElement.GetProperty("ProjectTestDirectory").GetString();
|
2021-05-30 23:13:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static readonly string WechatCorpId;
|
|
|
|
|
public static readonly int WechatAgentId;
|
|
|
|
|
public static readonly string WechatAgentSecret;
|
2021-06-07 11:18:27 +08:00
|
|
|
|
|
|
|
|
|
public static readonly string ProjectSourceDirectory;
|
|
|
|
|
public static readonly string ProjectTestDirectory;
|
2021-05-30 23:13:46 +08:00
|
|
|
|
}
|
|
|
|
|
}
|