Files
natsdotnet/tests/NATS.Server.Tests/Subscriptions/SubListCtorAndNotificationParityTests.cs
Joseph Doherty c30e67a69d Fix E2E test gaps and add comprehensive E2E + parity test suites
- Fix pull consumer fetch: send original stream subject in HMSG (not inbox)
  so NATS client distinguishes data messages from control messages
- Fix MaxAge expiry: add background timer in StreamManager for periodic pruning
- Fix JetStream wire format: Go-compatible anonymous objects with string enums,
  proper offset-based pagination for stream/consumer list APIs
- Add 42 E2E black-box tests (core messaging, auth, TLS, accounts, JetStream)
- Add ~1000 parity tests across all subsystems (gaps closure)
- Update gap inventory docs to reflect implementation status
2026-03-12 14:09:23 -04:00

47 lines
1.3 KiB
C#

using NATS.Server.Subscriptions;
namespace NATS.Server.Tests.Subscriptions;
public class SubListCtorAndNotificationParityTests
{
[Fact]
public void Constructor_with_enableCache_false_disables_cache()
{
var subList = new SubList(enableCache: false);
subList.CacheEnabled().ShouldBeFalse();
}
[Fact]
public void NewSublistNoCache_factory_disables_cache()
{
var subList = SubList.NewSublistNoCache();
subList.CacheEnabled().ShouldBeFalse();
}
[Fact]
public void RegisterNotification_emits_true_on_first_interest_and_false_on_last_interest()
{
var subList = new SubList();
var notifications = new List<bool>();
subList.RegisterNotification(v => notifications.Add(v));
var sub = new Subscription { Subject = "foo", Sid = "1" };
subList.Insert(sub);
subList.Remove(sub);
notifications.ShouldBe([true, false]);
}
[Fact]
public void SubjectMatch_alias_helpers_match_existing_behavior()
{
SubjectMatch.SubjectHasWildcard("foo.*").ShouldBeTrue();
SubjectMatch.SubjectHasWildcard("foo.bar").ShouldBeFalse();
SubjectMatch.IsValidLiteralSubject("foo.bar").ShouldBeTrue();
SubjectMatch.IsValidLiteralSubject("foo.*").ShouldBeFalse();
}
}