test: verify internal client kinds (Gap 5.9)
This commit is contained in:
50
tests/NATS.Server.Tests/ClientKindTests.cs
Normal file
50
tests/NATS.Server.Tests/ClientKindTests.cs
Normal file
@@ -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<ClientKind>().Length.ShouldBe(7);
|
||||
|
||||
[Fact]
|
||||
public void Internal_kinds_count_is_three() =>
|
||||
Enum.GetValues<ClientKind>().Count(k => k.IsInternal()).ShouldBe(3);
|
||||
|
||||
[Fact]
|
||||
public void External_kinds_count_is_four() =>
|
||||
Enum.GetValues<ClientKind>().Count(k => !k.IsInternal()).ShouldBe(4);
|
||||
}
|
||||
Reference in New Issue
Block a user