public void AddPublisher_BeforeRunning_DoesNotBindReceiver() { // Arrange var monitor = new NetMQMonitor(poller); // Act monitor.AddPublisher(publisher); // Assert mockPublisher.Verify(m => m.InitializeConnection(), Times.Never); }
public void AddPublisher_WithReceiver_AddsPollableSocketToPoller() { // Arrange var monitor = new NetMQMonitor(poller); // Act monitor.AddPublisher(publisher); // Assert mockPoller.Verify(m => m.Add(It.IsIn(pollableSocket)), Times.Once); }
public void AddPublisher_WithNullReceiver_DoesNotThrow() { // Arrange var monitor = new NetMQMonitor(poller); // Act TestDelegate add = () => monitor.AddPublisher(null); // Assert Assert.That(add, Throws.Nothing); }
public void StartMonitor_WithPublisherAdded_BindsReceiver() { // Arrange var monitor = new NetMQMonitor(poller); monitor.AddPublisher(publisher); // Act monitor.StartMonitoring(); // Assert mockPublisher.Verify(m => m.InitializeConnection(), Times.Once); }
public void AddPublisher_AfterStopped_DoesNotBindReceiver() { // Arrange var monitor = new NetMQMonitor(poller); monitor.StartMonitoring(); monitor.StopMonitoring(); // Act monitor.AddPublisher(publisher); // Assert mockPublisher.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); }
public void StartMonitor_WhenRunning_DoesNotRecallStartMethods() { // Arrange var monitor = new NetMQMonitor(poller); monitor.StartMonitoring(); monitor.AddSender(sender); monitor.AddReceiver(receiver); monitor.AddPublisher(publisher); monitor.AddSubscriber(subscriber); // Act monitor.StartMonitoring(); // Assert mockPoller.Verify(m => m.RunAsync(), Times.Once); mockSender.Verify(m => m.InitializeConnection(), Times.Once); mockReceiver.Verify(m => m.InitializeConnection(), Times.Once); mockPublisher.Verify(m => m.InitializeConnection(), Times.Once); mockSubscriber.Verify(m => m.InitializeConnection(), Times.Once); }