-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
猿人易
committed
Feb 12, 2025
1 parent
fddb270
commit 7610d11
Showing
2 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using NewLife.Reflection; | ||
using Stardust.Data.Monitors; | ||
using Xunit; | ||
using static Stardust.Server.Services.MonitorService; | ||
|
||
namespace Stardust.ServerTests.Services; | ||
|
||
public class MonitorServiceTests | ||
{ | ||
[Fact] | ||
public void GetClientTest() | ||
{ | ||
var actor = new WebHookActor(); | ||
actor.App = new AppTracer { WebHook = "https://newlifex.com/monitor/push?id=1234#token=abcd" }; | ||
|
||
var uri = new Uri(actor.App.WebHook); | ||
Assert.Equal("newlifex.com", uri.Host); | ||
Assert.Equal("/monitor/push", uri.AbsolutePath); | ||
Assert.Equal("?id=1234", uri.Query); | ||
Assert.Equal("/monitor/push?id=1234", uri.PathAndQuery); | ||
|
||
var client = actor.GetClient(); | ||
Assert.NotNull(client); | ||
Assert.Equal("/monitor/push?id=1234", actor.GetValue("_action")); | ||
Assert.Equal("abcd", actor.GetValue("_token")); | ||
} | ||
} |