Files
yunhai.netcore.tool/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/DebugMain.cs
T
wanghu 4226b042a8
ci / build-test (push) Failing after 2m18s
ci / publish (push) Skipped
添加教师树
2026-09-08 16:30:00 +08:00

59 lines
2.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 测试工程的运行调试入口(非测试用例)。
//
// 用法:
// dotnet run --project tests/Yh.SchClass.OpenApi.Tests # 一键跑通全部 20 个端点
// dotnet run --project tests/Yh.SchClass.OpenApi.Tests -- --only=OAStu
// dotnet run --project tests/Yh.SchClass.DebugTool -- --list # 端点名清单见 DebugTool
//
// 地址优先级同 SchClassLiveDebug:环境变量 YH_SCHCLASS_DEBUG_* → appsettings.json → 内置默认。
// 在 IDE 里直接 F5 调试本项目即可进入这里(在 Main 内打断点)。
//
// 注意:csproj 已设 GenerateProgramFile=false(关掉 Test SDK 自动 Main),dotnet test 不受影响。
using Microsoft.VisualStudio.TestPlatform.Utilities;
using System.Text;
namespace Yh.SchClass.OpenApi.Tests;
public static class DebugMain
{
public static async Task<int> Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;
var sch = "8d920c30-0f9b-4d8c-8a9f-2f9682899635";
var api = SchClassLiveDebug.Create();
var teachers = await api.TeaInfo.GetSchTeaInfoAsync(sch, null);
Console.WriteLine($"OATea[{sch}] 共 {teachers.Count} 名教师");
//string? only = null;
//foreach (var arg in args)
//{
// if (arg.StartsWith("--only=", StringComparison.OrdinalIgnoreCase))
// {
// only = arg[7..].Trim();
// }
// else if (arg.Equals("--off", StringComparison.OrdinalIgnoreCase))
// {
// Console.WriteLine("跳过联调:--off(同 YH_SCHCLASS_DEBUG_OFF=1)");
// return 0;
// }
//}
//if (Environment.GetEnvironmentVariable(SchClassLiveDebug.OffVar) is "1" or "true")
//{
// Console.WriteLine("跳过联调:已设置 " + SchClassLiveDebug.OffVar + "=1(清除该变量即可恢复联调)");
// return 0;
//}
//Console.WriteLine("== SchClass OpenAPI 测试工程调试入口 ==");
//var failures = await SchClassLiveDebug.RunAllAsync(Console.WriteLine, only);
//if (failures.Count == 0)
//{
// Console.WriteLine("全部通过 ✅");
// return 0;
//}
//Console.WriteLine($"失败 {failures.Count} 个:{string.Join(", ", failures)}");
return 1;
}
}