public void AddSender_BeforeRunning_DoesNotBindReceiver() { // Arrange var monitor = new NetMQMonitor(poller); // Act monitor.AddSender(sender); // Assert mockReceiver.Verify(m => m.InitializeConnection(), Times.Never); }
public void AddSender_WithNullReceiver_DoesNotThrow() { // Arrange var monitor = new NetMQMonitor(poller); // Act TestDelegate add = () => monitor.AddSender(null); // Assert Assert.That(add, Throws.Nothing); }
public void AddSender_WithReceiver_AddsPollableSocketToPoller() { // Arrange var monitor = new NetMQMonitor(poller); // Act monitor.AddSender(sender); // Assert mockPoller.Verify(m => m.Add(It.IsIn(pollableSocket)), Times.Once); }
public void StartMonitor_WithSenderAdded_ConnectsSender() { // Arrange var monitor = new NetMQMonitor(poller); monitor.AddSender(sender); // Act monitor.StartMonitoring(); // Assert mockSender.Verify(m => m.InitializeConnection(), Times.Once); }
public void AddSender_AfterStopped_DoesNotBindReceiver() { // Arrange var monitor = new NetMQMonitor(poller); monitor.StartMonitoring(); monitor.StopMonitoring(); // Act monitor.AddSender(sender); // Assert mockReceiver.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); }