public void ClearDropsAllIds() { var client = new Mock <ISubscriptionClientProxy>().Object; var idSet = new ClientTrackedMessageIdSet(); var result = idSet.ReserveMessageId("abc123"); Assert.IsTrue(result); result = idSet.ReserveMessageId("abc1234"); Assert.IsTrue(result); idSet.Clear(); Assert.IsFalse(idSet.Contains("abc123")); Assert.IsFalse(idSet.Contains("abc1234")); }
/// <summary> /// Informs any event listeners that this client is shutting down and discontinuing all subscriptions. /// </summary> private void ProcessCloseRequest() { // discontinue all client registered subscriptions // and acknowledge the terminate request var fields = _subscriptions.Select(x => x.Field).Distinct(); foreach (var field in fields) { this.SubscriptionRouteRemoved?.Invoke(this, new ApolloSubscriptionFieldEventArgs(field)); } _subscriptions.Clear(); _reservedMessageIds.Clear(); this.ConnectionClosed?.Invoke(this, EventArgs.Empty); _connectionClosedForever = true; }