public void RemoveSubscriber_Success() { var container = new TopicContainer(); ISubscriber sub; container.HasSubscriber("sub1").Is(false); container.GetSubscribers().Count.Is(0); container.AddSubscriber(new Subscriber <std_msgs.String>("sub1", "test")).Is(true); container.HasSubscriber("sub1").Is(true); container.GetSubscribers().Count.Is(1); container.GetSubscriber("sub1", out sub).Is(true); container.RemoveSubscriber("sub1").Is(true); container.GetSubscriber("sub1", out sub).Is(false); container.RemoveSubscriber("sub1").Is(false); }
private Task DisposeSubscriberAsync(string topicName) { _logger.Debug(m => m("Disposing Subscriber[{0}]", topicName)); return(_masterClient .UnregisterSubscriberAsync(NodeId, topicName, _slaveServer.SlaveUri) .ContinueWith(task => { if (task.IsFaulted) { _logger.Error("UnregisterSubscriber: Failure", task.Exception.InnerException); } _topicContainer.RemoveSubscriber(topicName); _logger.Debug(m => m("UnregisterSubscriber: [{0}]", topicName)); })); }