-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from Sharp-Pulsar/consumer
Consumer updates
- Loading branch information
Showing
78 changed files
with
3,668 additions
and
1,373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/SharpPulsar.Test.API/TopicConsumerConfigurationDataTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
| ||
using SharpPulsar.Configuration; | ||
using static SharpPulsar.Configuration.TopicConsumerConfigurationData; | ||
|
||
namespace SharpPulsar.Test | ||
{ | ||
public class TopicConsumerConfigurationDataTest | ||
{ | ||
[Fact] | ||
public void TestOfFactoryMethod() | ||
{ | ||
var topicConsumerConfigurationData = OfTopicName("foo", 1); | ||
|
||
Assert.True(topicConsumerConfigurationData.GetTopicNameMatcher().Matches("foo")); | ||
Assert.Equal(1, topicConsumerConfigurationData.PriorityLevel()); | ||
|
||
var pattern = new TopicConsumerConfigurationData(new TopicsPattern("^foo$"), 1); | ||
Assert.True(pattern.GetTopicNameMatcher().Matches("foo")); | ||
Assert.Equal(1, pattern.PriorityLevel()); | ||
} | ||
[Fact] | ||
public void TestOfDefaultFactoryMethod() | ||
{ | ||
var consumerConfigurationData = new ConsumerConfigurationData<object>(); | ||
consumerConfigurationData.PriorityLevel = 1; | ||
var topicConsumerConfigurationData = OfTopicName("foo", consumerConfigurationData); | ||
|
||
Assert.True(topicConsumerConfigurationData.GetTopicNameMatcher().Matches("foo")); | ||
Assert.Equal(1, topicConsumerConfigurationData.PriorityLevel()); | ||
} | ||
|
||
public static object[][] TopicNameMatch() | ||
{ | ||
return new object[][] | ||
{ | ||
new object[] {"foo", true}, | ||
new object[] {"bar", false} | ||
}; | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(TopicNameMatch))] | ||
public void TestTopicNameMatch(string topicName, bool expectedMatch) | ||
{ | ||
var topicConsumerConfigurationData = OfTopicsPattern("^foo$", 1); | ||
Assert.Equal(expectedMatch, topicConsumerConfigurationData.GetTopicNameMatcher().Matches(topicName)); | ||
} | ||
|
||
|
||
[Fact] | ||
public void TestTopicNameMatchNullTopicName() | ||
{ | ||
Assert.False(OfTopicName("foo", 1).GetTopicNameMatcher().Matches(null)); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.