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

            // Act
            TestDelegate removeAddress = () => publisher.RemoveAddress(address);

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

            // Cleanup
            publisher.Dispose();
        }
예제 #2
0
        public void RemoveAddress_WithAddedAddress_RemovesFromAddresses()
        {
            // Arrange
            var socket    = new PublisherSocket();
            var publisher = new NetMQPublisher(socket, messageFactory);

            publisher.AddAddress(address);

            // Act
            publisher.RemoveAddress(address);

            // Assert
            CollectionAssert.DoesNotContain(publisher.Addresses, address);

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

            publisher.AddAddress(address);

            // Act
            publisher.RemoveAddress(address);

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

            // Cleanup
            publisher.Dispose();
        }
예제 #4
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();
        }