This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
//
|
||||
// 注意:csproj 已设 GenerateProgramFile=false(关掉 Test SDK 自动 Main),dotnet test 不受影响。
|
||||
|
||||
using Microsoft.VisualStudio.TestPlatform.Utilities;
|
||||
using System.Text;
|
||||
|
||||
namespace Yh.SchClass.OpenApi.Tests;
|
||||
@@ -20,34 +21,38 @@ public static class DebugMain
|
||||
{
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
//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)}");
|
||||
//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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user