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 ConnectToCityindexStreamingAdapter(string streamingUrl, LsCityindexStreamingConnectionFactory lsCityindexStreamingConnectionFactory) { if (_cityindexStreamingAdapterIsConnected) { throw new InvalidOperationException("Can only have one connection open to a lightstreamer cityindex streaming adapter."); } var cityIndexStreamingAdapterUri = streamingUrl + CITYINDEX_STREAMING_ADAPTER; Log.Info("Connecting to lightstreamer uri: " + cityIndexStreamingAdapterUri); _lsCityindexStreamingConnection = lsCityindexStreamingConnectionFactory.Create(new Uri(cityIndexStreamingAdapterUri), _apiConnection.UserName, _apiConnection.Session); if (_lsCityindexStreamingConnection == null) { throw new NullReferenceException("Could not create CityindexStreaming adapter connection."); } _lsCityindexStreamingConnection.StatusChanged += new EventHandler <StatusEventArgs>(LsCityindexStreamingClientConnectionStatusChanged); _lsCityindexStreamingConnection.Connect(); _cityindexStreamingAdapterIsConnected = true; }