public void StreamingManagerDisconnectCallsDisconnectOnTheLightStreamerConnectionManager()
        {
            // Arrange
            _mockLightStreamerConnectionManager.Expect(x => x.Disconnect());

            // Act - then disconnect
            _streamingManager.Disconnect();

            // Assert
            _mockLightStreamerConnectionManager.VerifyAllExpectations();
        }
Ejemplo n.º 2
0
        public void PriceStreamPropertyConnectsToTheCityIndexStreamingAdapterTheFirstTimeItsCalled()
        {
            //Arrange
            _mockStreamingManager.Expect(x => x.LightStreamerConnectionManager)
            .Return(_mockLightStreamerConnectionManager)
            .Repeat.Any();

            _mockLightStreamerConnectionManager.Expect(x => x.LsCityindexStreamingConnection)
            .Return(_mockLsCityindexStreamingConnection)
            .Repeat.Any();

            _mockLightStreamerConnectionManager.Expect(x => x.CityindexStreamingAdaterIsConnected)
            .Return(false);

            _mockStreamingManager.Expect(x => x.StreamingUrl).Return(STREAMING_URL);

            string streamingUrlUsed = "";

            _mockLightStreamerConnectionManager.Expect(x => x.ConnectToCityindexStreamingAdapter(Arg <string> .Is.Anything,
                                                                                                 Arg <LsCityindexStreamingConnectionFactory> .Is.Anything))
            .Repeat.Once()
            .WhenCalled(x => streamingUrlUsed = (string)x.Arguments[0]);

            // Act
            var priceStream = _streams.PriceStream;

            // Assert
            Assert.AreEqual(STREAMING_URL, streamingUrlUsed);
            _mockStreamingManager.VerifyAllExpectations();
            _mockLightStreamerConnectionManager.VerifyAllExpectations();
        }