Files
BiliBiliToolPro/test/LogTest/TestWorkWeiXinApp.cs
database-mysql e519cac94e
Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
Close Stale Issues / close_stale_issues (push) Has been cancelled
repo-sync / repo-sync (push) Has been cancelled
auto-deploy-tencent-scf / pre-check (push) Has been cancelled
auto-deploy-tencent-scf / deploy serverless (push) Has been cancelled
pull file
2026-02-11 23:32:56 +08:00

44 lines
1.3 KiB
C#

using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Ray.BiliBiliTool.Console;
using Ray.BiliBiliTool.Infrastructure;
using Ray.Serilog.Sinks.WorkWeiXinAppBatched;
using Xunit;
namespace LogTest
{
public class TestWorkWeiXinApp
{
private string _agentId;
private string _secret;
private string _corpId;
private string _toUser;
public TestWorkWeiXinApp()
{
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Development");
Program.CreateHost(new string[] { "ENVIRONMENT=Development" });
_agentId = Global.ConfigurationRoot["Serilog:WriteTo:11:Args:agentId"];
_secret = Global.ConfigurationRoot["Serilog:WriteTo:11:Args:secret"];
_corpId = Global.ConfigurationRoot["Serilog:WriteTo:11:Args:corpId"];
_toUser = Global.ConfigurationRoot["Serilog:WriteTo:11:Args:toUser"];
}
[Fact]
public async Task Test()
{
var client = new WorkWeiXinAppApiClient(_corpId, _agentId, _secret, _toUser);
var msg = LogConstants.Msg2;
var result = await client.PushMessageAsync(msg);
Debug.WriteLine(result.Content.ReadAsStringAsync().Result);
Assert.True(result.StatusCode == System.Net.HttpStatusCode.OK);
}
}
}