using NATS.Client.Core; namespace NATS.E2E.Tests.Infrastructure; public sealed class AccountServerFixture : IAsyncLifetime { private NatsServerProcess _server = null!; public int Port => _server.Port; public async Task InitializeAsync() { var config = """ accounts { ACCT_A { users = [ { user: "user_a", password: "pass_a" } ] } ACCT_B { users = [ { user: "user_b", password: "pass_b" } ] } } """; _server = NatsServerProcess.WithConfig(config); await _server.StartAsync(); } public async Task DisposeAsync() { await _server.DisposeAsync(); } public NatsConnection CreateClientA() { return new NatsConnection(new NatsOpts { Url = $"nats://user_a:pass_a@127.0.0.1:{Port}" }); } public NatsConnection CreateClientB() { return new NatsConnection(new NatsOpts { Url = $"nats://user_b:pass_b@127.0.0.1:{Port}" }); } } [CollectionDefinition("E2E-Accounts")] public class AccountsCollection : ICollectionFixture;