Files
natsdotnet/tests/NATS.Server.Core.Tests/ClientKindTests.cs
Joseph Doherty 7fbffffd05 refactor: rename remaining tests to NATS.Server.Core.Tests
- Rename tests/NATS.Server.Tests -> tests/NATS.Server.Core.Tests
- Update solution file, InternalsVisibleTo, and csproj references
- Remove JETSTREAM_INTEGRATION_MATRIX and NATS.NKeys from csproj (moved to JetStream.Tests and Auth.Tests)
- Update all namespaces from NATS.Server.Tests.* to NATS.Server.Core.Tests.*
- Replace private GetFreePort/ReadUntilAsync helpers with TestUtilities calls
- Fix stale namespace in Transport.Tests/NetworkingGoParityTests.cs
2026-03-12 16:14:02 -04:00

51 lines
1.4 KiB
C#

// 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.Core.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);
}