feat(batch18): implement group-b server core helpers

This commit is contained in:
Joseph Doherty
2026-02-28 19:24:25 -05:00
parent f8d384711d
commit 108d06dd57
6 changed files with 180 additions and 7 deletions

View File

@@ -7,6 +7,29 @@ namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog;
public sealed partial class RouteHandlerTests
{
[Fact]
public void NumRemotesInternal_WhenRoutesExist_ReturnsCount()
{
var (server, err) = NatsServer.NewServer(new ServerOptions());
err.ShouldBeNull();
server.ShouldNotBeNull();
var routesField = typeof(NatsServer).GetField("_routes", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
routesField.ShouldNotBeNull();
routesField!.SetValue(
server,
new Dictionary<string, List<ClientConnection>>
{
["one"] = [],
["two"] = [],
});
var method = typeof(NatsServer).GetMethod("NumRemotesInternal", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
method.ShouldNotBeNull();
var count = (int)method!.Invoke(server, null)!;
count.ShouldBe(2);
}
[Fact] // T:2854
public void RouteCompressionAuto_ShouldSucceed()
{