This is an automated email from the ASF dual-hosted git repository.

blankensteiner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-dotpulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new c788463  Adding MessageProcessor tests
c788463 is described below

commit c788463fce226fa2173ee1496c4f12576e4f5e24
Author: Daniel Blankensteiner <[email protected]>
AuthorDate: Tue Jun 18 11:52:49 2024 +0200

    Adding MessageProcessor tests
---
 CHANGELOG.md                                       |  4 ++
 .../Internal/MessageProcessorTests.cs              | 43 ++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 03fe981..feba83d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ The format is based on [Keep a 
Changelog](https://keepachangelog.com/en/1.1.0/)
 
 ## [Unreleased]
 
+### Added
+
+- The consumer's subscription type is now part of the `IConsumer` interface
+
 ### Fixed
 
 - Fixed race condition in `Producer` between `Send(...)` and `DisposeAsync()` 
dispose causing an unintended `DivideByZeroException`.
diff --git a/tests/DotPulsar.Tests/Internal/MessageProcessorTests.cs 
b/tests/DotPulsar.Tests/Internal/MessageProcessorTests.cs
new file mode 100644
index 0000000..9a6955d
--- /dev/null
+++ b/tests/DotPulsar.Tests/Internal/MessageProcessorTests.cs
@@ -0,0 +1,43 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace DotPulsar.Tests.Internal;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using DotPulsar.Internal;
+
+[Trait("Category", "Unit")]
+public sealed class MessageProcessorTests
+{
+    [Theory]
+    [InlineAutoData(SubscriptionType.Shared)]
+    [InlineAutoData(SubscriptionType.KeyShared)]
+    public void 
Constructor_GivenSharedSubscriptionTypeWithOrderedAcknowledgment_ShouldThrowProcessingException(
+        SubscriptionType subscriptionType,
+        [AutoFixture.Xunit2.Frozen] IConsumer<byte[]> consumer,
+        ProcessingOptions options)
+    {
+        //Arrange
+        consumer.SubscriptionType.Returns(subscriptionType);
+
+        //Act
+        var exception = Record.Exception(() => new 
MessageProcessor<byte[]>(consumer, ProcessMessage, options));
+
+        //Assert
+        exception.Should().BeOfType<ProcessingException>();
+    }
+
+    private static ValueTask ProcessMessage(IMessage<byte[]> _1, 
CancellationToken _2) => ValueTask.CompletedTask;
+}

Reply via email to