Extract INatsClient interface from NatsClient to enable internal clients (SYSTEM, ACCOUNT) to participate in the subscription system without requiring a socket connection. Change Subscription.Client from concrete NatsClient to INatsClient, keeping IMessageRouter and RemoveClient using the concrete type since only socket clients need those paths.
30 lines
834 B
C#
30 lines
834 B
C#
namespace NATS.Server.Tests;
|
|
|
|
public class InternalClientTests
|
|
{
|
|
[Theory]
|
|
[InlineData(ClientKind.Client, false)]
|
|
[InlineData(ClientKind.Router, false)]
|
|
[InlineData(ClientKind.Gateway, false)]
|
|
[InlineData(ClientKind.Leaf, false)]
|
|
[InlineData(ClientKind.System, true)]
|
|
[InlineData(ClientKind.JetStream, true)]
|
|
[InlineData(ClientKind.Account, true)]
|
|
public void IsInternal_returns_correct_value(ClientKind kind, bool expected)
|
|
{
|
|
kind.IsInternal().ShouldBe(expected);
|
|
}
|
|
|
|
[Fact]
|
|
public void NatsClient_implements_INatsClient()
|
|
{
|
|
typeof(NatsClient).GetInterfaces().ShouldContain(typeof(INatsClient));
|
|
}
|
|
|
|
[Fact]
|
|
public void NatsClient_kind_is_Client()
|
|
{
|
|
typeof(NatsClient).GetProperty("Kind")!.PropertyType.ShouldBe(typeof(ClientKind));
|
|
}
|
|
}
|