Add desktop discovery responder

This commit is contained in:
Misaka
2026-05-16 20:36:12 +08:00
parent 4f6e817a76
commit 4caa21c4d2
3 changed files with 134 additions and 0 deletions

View File

@@ -59,6 +59,21 @@ public sealed class SyncMessageTests
keyboard.Calls);
}
[TestMethod]
public void DiscoveryResponseContainsServiceEndpoint()
{
using var discovery = new DiscoveryResponderService(() => "192.168.1.10", () => 8181, "Desktop-WIN11");
using var document = JsonDocument.Parse(discovery.BuildResponseJson());
var root = document.RootElement;
Assert.AreEqual("wirelessTextSyncer.service", root.GetProperty("type").GetString());
Assert.AreEqual(1, root.GetProperty("version").GetInt32());
Assert.AreEqual("Desktop-WIN11", root.GetProperty("name").GetString());
Assert.AreEqual("192.168.1.10", root.GetProperty("host").GetString());
Assert.AreEqual(8181, root.GetProperty("port").GetInt32());
}
private sealed class RecordingKeyboardInjectionService : IKeyboardInjectionService
{
public List<string> Calls { get; } = [];