using NATS.Server.Subscriptions; namespace NATS.Server.Core.Tests; public class SubListNotificationTests { [Fact] public void Interest_change_notifications_are_emitted_for_local_and_remote_changes() { using var sl = new SubList(); var changes = new List(); sl.InterestChanged += changes.Add; var sub = new Subscription { Subject = "orders.created", Sid = "1" }; sl.Insert(sub); sl.Remove(sub); sl.ApplyRemoteSub(new RemoteSubscription("orders.*", null, "r1", "A")); sl.ApplyRemoteSub(RemoteSubscription.Removal("orders.*", null, "r1", "A")); changes.Count.ShouldBe(4); changes.Select(c => c.Kind).ShouldContain(InterestChangeKind.LocalAdded); changes.Select(c => c.Kind).ShouldContain(InterestChangeKind.RemoteAdded); } }