public void StopMonitoring_WhenRunning_StopsPoller() { // Arrange var monitor = new NetMQMonitor(poller); monitor.StartMonitoring(); // Act monitor.StopMonitoring(); // Assert mockPoller.Verify(m => m.StopAsync(), Times.Once); }
public void StopMonitoring_WithSubscriberAdded_UnbindsReceiver() { // Arrange var monitor = new NetMQMonitor(poller); monitor.AddSubscriber(subscriber); monitor.StartMonitoring(); // Act monitor.StopMonitoring(); // Assert mockSubscriber.Verify(m => m.TerminateConnection(), Times.Once); }
public void StopMonitoring_WithSenderAdded_DisconnectsSender() { // Arrange var monitor = new NetMQMonitor(poller); monitor.AddSender(sender); monitor.StartMonitoring(); // Act monitor.StopMonitoring(); // Assert mockSender.Verify(m => m.TerminateConnection(), Times.Once); }
public void AddSubscriber_AfterStopped_DoesNotBindReceiver() { // Arrange var monitor = new NetMQMonitor(poller); monitor.StartMonitoring(); monitor.StopMonitoring(); // Act monitor.AddSubscriber(subscriber); // Assert mockSubscriber.Verify(m => m.InitializeConnection(), Times.Never); }
public void StopMonitoring_BeforeStarted_DoesNothing() { // Arrange var monitor = new NetMQMonitor(poller); monitor.AddSender(sender); monitor.AddReceiver(receiver); monitor.AddPublisher(publisher); monitor.AddSubscriber(subscriber); // Act monitor.StopMonitoring(); // Assert mockPoller.Verify(m => m.StopAsync(), Times.Never); mockSender.Verify(m => m.TerminateConnection(), Times.Never); mockReceiver.Verify(m => m.TerminateConnection(), Times.Never); mockPublisher.Verify(m => m.InitializeConnection(), Times.Never); mockSubscriber.Verify(m => m.InitializeConnection(), Times.Never); }