예제 #1
0
        public void BindAll_WhenAlreadyBound_DoesNothing()
        {
            // Arrange
            var socket    = new PublisherSocket();
            var publisher = new NetMQPublisher(socket, messageFactory);

            publisher.InitializeConnection();

            // Act
            TestDelegate bindAll = () => publisher.InitializeConnection();

            // Assert
            Assert.That(bindAll, Throws.Nothing);

            // Cleanup
            publisher.TerminateConnection();
            publisher.Dispose();
        }
예제 #2
0
        public void Remove_WithAddedAddress_IsConnectedTrue()
        {
            // Arrange
            var socket    = new PublisherSocket();
            var publisher = new NetMQPublisher(socket, messageFactory);
            var address   = TcpAddress.Wildcard(5555);
            var address2  = TcpAddress.Wildcard(5556);

            publisher.AddAddress(address);
            publisher.AddAddress(address2);
            publisher.InitializeConnection();

            // Act
            publisher.RemoveAddress(address);

            // Assert
            Assert.That(publisher.IsConnected, Is.True);

            // Cleanup
            publisher.TerminateConnection();
            publisher.Dispose();
        }