diff --git a/Npgmq.Test/NpgmqClientTest.cs b/Npgmq.Test/NpgmqClientTest.cs index d20e482..5cc4ecb 100644 --- a/Npgmq.Test/NpgmqClientTest.cs +++ b/Npgmq.Test/NpgmqClientTest.cs @@ -56,6 +56,22 @@ private async Task IsMinPgmqVersion(string minVersion) return version is not null && new Version(version) >= new Version(minVersion); } + [Fact] + public async Task NpgmqClient_should_work_when_created_using_a_connection_string() + { + // Arrange + await ResetTestQueueAsync(); + var sut = new NpgmqClient(_connectionString); // Don't use _sut here, as we want to test a new instance + + // Act + await sut.SendAsync(TestQueueName, new TestMessage { Foo = 123 }); + var msg = await sut.ReadAsync(TestQueueName); + + // Assert + Assert.NotNull(msg); + msg.Message.ShouldDeepEqual(new TestMessage { Foo = 123 }); + } + [Fact] public async Task ArchiveAsync_should_archive_a_single_message() { diff --git a/Npgmq/NpgmqClient.cs b/Npgmq/NpgmqClient.cs index 210501f..4163b27 100644 --- a/Npgmq/NpgmqClient.cs +++ b/Npgmq/NpgmqClient.cs @@ -16,7 +16,7 @@ public class NpgmqClient : INpgmqClient private readonly NpgmqCommandFactory _commandFactory; /// - /// Create a new . + /// Create a new using a connection string. /// /// The connection string. public NpgmqClient(string connectionString) @@ -25,7 +25,7 @@ public NpgmqClient(string connectionString) } /// - /// Create a new . + /// Create a new using an existing . /// /// The connection to use. public NpgmqClient(NpgsqlConnection connection)