Move 25 gateway-related test files from NATS.Server.Tests into a dedicated NATS.Server.Gateways.Tests project. Update namespaces, replace private ReadUntilAsync with SocketTestHelper from TestUtilities, inline TestServerFactory usage, add InternalsVisibleTo, and register the project in the solution file. All 261 tests pass.
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using Microsoft.Extensions.Logging.Abstractions;
|
|
using NATS.Server.Configuration;
|
|
|
|
namespace NATS.Server.Gateways.Tests.Gateways;
|
|
|
|
public class GatewayServerAccessorParityBatch4Tests
|
|
{
|
|
[Fact]
|
|
public void Gateway_address_url_and_name_accessors_reflect_gateway_options()
|
|
{
|
|
using var server = new NatsServer(
|
|
new NatsOptions
|
|
{
|
|
Gateway = new GatewayOptions
|
|
{
|
|
Name = "gw-a",
|
|
Host = "127.0.0.1",
|
|
Port = 7222,
|
|
},
|
|
},
|
|
NullLoggerFactory.Instance);
|
|
|
|
server.GatewayAddr().ShouldBe("127.0.0.1:7222");
|
|
server.GetGatewayURL().ShouldBe("127.0.0.1:7222");
|
|
server.GetGatewayName().ShouldBe("gw-a");
|
|
}
|
|
|
|
[Fact]
|
|
public void Gateway_accessors_return_null_when_gateway_is_not_configured()
|
|
{
|
|
using var server = new NatsServer(new NatsOptions(), NullLoggerFactory.Instance);
|
|
|
|
server.GatewayAddr().ShouldBeNull();
|
|
server.GetGatewayURL().ShouldBeNull();
|
|
server.GetGatewayName().ShouldBeNull();
|
|
}
|
|
}
|