From a6e8088526195e809aa58e7d30e27bf99efa2cf7 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Wed, 25 Feb 2026 11:35:21 -0500 Subject: [PATCH] test: verify internal client kinds (Gap 5.9) --- tests/NATS.Server.Tests/ClientKindTests.cs | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/NATS.Server.Tests/ClientKindTests.cs diff --git a/tests/NATS.Server.Tests/ClientKindTests.cs b/tests/NATS.Server.Tests/ClientKindTests.cs new file mode 100644 index 0000000..bc006cc --- /dev/null +++ b/tests/NATS.Server.Tests/ClientKindTests.cs @@ -0,0 +1,50 @@ +// Tests for ClientKind enum and IsInternal() extension method. +// Go reference: client.go:45-65 (client kind constants and isInternal check) + +using NATS.Server; +using Shouldly; + +namespace NATS.Server.Tests; + +public class ClientKindTests +{ + [Fact] + public void Client_is_not_internal() => + ClientKind.Client.IsInternal().ShouldBeFalse(); + + [Fact] + public void Router_is_not_internal() => + ClientKind.Router.IsInternal().ShouldBeFalse(); + + [Fact] + public void Gateway_is_not_internal() => + ClientKind.Gateway.IsInternal().ShouldBeFalse(); + + [Fact] + public void Leaf_is_not_internal() => + ClientKind.Leaf.IsInternal().ShouldBeFalse(); + + [Fact] + public void System_is_internal() => + ClientKind.System.IsInternal().ShouldBeTrue(); + + [Fact] + public void JetStream_is_internal() => + ClientKind.JetStream.IsInternal().ShouldBeTrue(); + + [Fact] + public void Account_is_internal() => + ClientKind.Account.IsInternal().ShouldBeTrue(); + + [Fact] + public void All_kinds_defined() => + Enum.GetValues().Length.ShouldBe(7); + + [Fact] + public void Internal_kinds_count_is_three() => + Enum.GetValues().Count(k => k.IsInternal()).ShouldBe(3); + + [Fact] + public void External_kinds_count_is_four() => + Enum.GetValues().Count(k => !k.IsInternal()).ShouldBe(4); +}