예제 #1
0
        public void StopMonitoring_WhenRunning_StopsPoller()
        {
            // Arrange
            var monitor = new NetMQMonitor(poller);

            monitor.StartMonitoring();

            // Act
            monitor.StopMonitoring();

            // Assert
            mockPoller.Verify(m => m.StopAsync(), Times.Once);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }