public void LightStreamerConnectionManagerDisconnectCallsDisconnectOnTheConnectionsIfNotNull()
        {
            // Arrange
            // Create a valid lightstreamer connections
            _mockLsCityindexStreamingConnectionFactory.Expect(
                x => x.Create(Arg <Uri> .Is.Anything, Arg <string> .Is.Anything, Arg <string> .Is.Anything))
            .Return(_mockLsCityindexStreamingConnection);

            _mockLsStreamingClientAccountConnectionFactory.Expect(
                x => x.Create(Arg <Uri> .Is.Anything, Arg <string> .Is.Anything, Arg <string> .Is.Anything))
            .Return(_mockLsStreamingClientAccountConnection);

            _mockLsCityindexStreamingConnection.Expect(x => x.Disconnect()).Repeat.Once();
            _mockLsStreamingClientAccountConnection.Expect(x => x.Disconnect()).Repeat.Once();

            // Act
            var lightStreamerConnectionManager = new LightStreamerConnectionManager(_mockApiConnection);

            lightStreamerConnectionManager.ConnectToStreamingClientAccountAdapter(STREAMING_URL, _mockLsStreamingClientAccountConnectionFactory);
            lightStreamerConnectionManager.ConnectToCityindexStreamingAdapter(STREAMING_URL, _mockLsCityindexStreamingConnectionFactory);

            // Act - then disconnect
            lightStreamerConnectionManager.Disconnect();
            // this time we do not expect the lightstreamerClientConnection Disconnect to be called
            lightStreamerConnectionManager.Disconnect();

            // Assert
            Assert.IsFalse(lightStreamerConnectionManager.StreamingClientAccountAdapterIsConnected);
            Assert.IsFalse(lightStreamerConnectionManager.CityindexStreamingAdaterIsConnected);
            _mockLsCityindexStreamingConnectionFactory.VerifyAllExpectations();
            _mockLsStreamingClientAccountConnectionFactory.VerifyAllExpectations();
            _mockLsCityindexStreamingConnection.VerifyAllExpectations();
            _mockLsStreamingClientAccountConnection.VerifyAllExpectations();
        }
 public virtual void Disconnect()
 {
     try
     {
         _lightStreamerConnectionManager.Disconnect();
         Log.Debug("Streaming clients disconnected.");
         
     }
     catch (Exception ex)
     {
         Log.Error("Error trying to disconnect streaming client: " + ex);
         throw;
     }
 }