Files
natsdotnet/tests/NATS.Server.Core.Tests/Subscriptions/SubjectSubsetMatchParityBatch1Tests.cs
Joseph Doherty 7fbffffd05 refactor: rename remaining tests to NATS.Server.Core.Tests
- Rename tests/NATS.Server.Tests -> tests/NATS.Server.Core.Tests
- Update solution file, InternalsVisibleTo, and csproj references
- Remove JETSTREAM_INTEGRATION_MATRIX and NATS.NKeys from csproj (moved to JetStream.Tests and Auth.Tests)
- Update all namespaces from NATS.Server.Tests.* to NATS.Server.Core.Tests.*
- Replace private GetFreePort/ReadUntilAsync helpers with TestUtilities calls
- Fix stale namespace in Transport.Tests/NetworkingGoParityTests.cs
2026-03-12 16:14:02 -04:00

41 lines
1.4 KiB
C#

using NATS.Server.Subscriptions;
namespace NATS.Server.Core.Tests.Subscriptions;
public class SubjectSubsetMatchParityBatch1Tests
{
[Theory]
[InlineData("foo.bar", "foo.bar", true)]
[InlineData("foo.bar", "foo.*", true)]
[InlineData("foo.bar", "foo.>", true)]
[InlineData("foo.bar", "*.*", true)]
[InlineData("foo.bar", ">", true)]
[InlineData("foo.bar", "foo.baz", false)]
[InlineData("foo.bar.baz", "foo.*", false)]
public void SubjectMatchesFilter_matches_go_subset_behavior(string subject, string filter, bool expected)
{
SubjectMatch.SubjectMatchesFilter(subject, filter).ShouldBe(expected);
}
[Fact]
public void SubjectIsSubsetMatch_uses_subject_tokens_against_test_pattern()
{
SubjectMatch.SubjectIsSubsetMatch("foo.*", "foo.*").ShouldBeTrue();
SubjectMatch.SubjectIsSubsetMatch("foo.*", "foo.bar").ShouldBeFalse();
}
[Fact]
public void IsSubsetMatch_tokenizes_test_subject_and_delegates_to_tokenized_matcher()
{
SubjectMatch.IsSubsetMatch(["foo", "bar"], "foo.*").ShouldBeTrue();
SubjectMatch.IsSubsetMatch(["foo", "bar"], "foo.baz").ShouldBeFalse();
}
[Fact]
public void IsSubsetMatchTokenized_handles_fwc_and_rejects_empty_tokens_like_go()
{
SubjectMatch.IsSubsetMatchTokenized(["foo", "bar"], ["foo", ">"]).ShouldBeTrue();
SubjectMatch.IsSubsetMatchTokenized(["foo", "bar"], ["foo", ""]).ShouldBeFalse();
}
}