public void SetUp() { _mockApiConnection = MockRepository.GenerateMock <IApiConnection>(); _mockLsCityindexStreamingConnectionFactory = MockRepository.GenerateMock <LsCityindexStreamingConnectionFactory>(); _mockLsStreamingClientAccountConnectionFactory = MockRepository.GenerateMock <LsStreamingClientAccountConnectionFactory>(); _mockLsCityindexStreamingConnection = MockRepository.GenerateMock <ILsCityindexStreamingConnection>(); _mockLsStreamingClientAccountConnection = MockRepository.GenerateMock <ILsStreamingClientAccountConnection>(); }
public virtual void ConnectToStreamingClientAccountAdapter(string streamingUrl, LsStreamingClientAccountConnectionFactory lsStreamingClientAccountConnectionFactory) { if (_streamingClientAccountAdapterIsConnected) { throw new InvalidOperationException("Can only have one connection open to a lightstreamer streaming client account adapter."); } var streamingClientAccountAdapterUri = streamingUrl + STREAMING_CLIENT_ACCOUNT_ADAPTER; Log.Info("Connecting to lightstreamer uri: " + streamingClientAccountAdapterUri); _lsStreamingClientAccountConnection = lsStreamingClientAccountConnectionFactory.Create(new Uri(streamingClientAccountAdapterUri), _apiConnection.UserName, _apiConnection.Session); if (_lsStreamingClientAccountConnection == null) { throw new NullReferenceException("Could not create StreamingClientAccount adapter connection."); } _lsStreamingClientAccountConnection.StatusChanged += new EventHandler <StatusEventArgs>(LsStreamingClientAccountConnectionStatusChanged); _lsStreamingClientAccountConnection.Connect(); _streamingClientAccountAdapterIsConnected = true; }