Пример #1
0
 public void StopSse()
 {
     try
     {
         _sseHandler.Stop();
     }
     catch (Exception ex)
     {
         _log.Error($"StopSse: {ex.Message}");
     }
 }
Пример #2
0
        public void Stop_ShouldDisconnect()
        {
            // Arrange.
            var token    = "fake-test";
            var channels = "channel-test";

            _eventSourceClient
            .Setup(mock => mock.ConnectAsync(It.IsAny <string>()))
            .Returns(true);

            // Act.
            var result = _sseHandler.Start(token, channels);

            _sseHandler.Stop();

            // Assert.
            Assert.IsTrue(result);
            _eventSourceClient.Verify(mock => mock.Disconnect(It.IsAny <SSEClientActions>()), Times.Once);
        }
Пример #3
0
        public void Stop_ShouldDisconnect()
        {
            // Arrange.
            var token    = "fake-test";
            var channels = "channel-test";

            _eventSourceClient
            .Setup(mock => mock.Disconnect(It.IsAny <bool>()))
            .Raises(mock => mock.DisconnectEvent += null, new FeedbackEventArgs(false));

            // Act.
            _sseHandler.Start(token, channels);
            _sseHandler.Stop();

            // Assert.
            _eventSourceClient.Verify(mock => mock.Disconnect(It.IsAny <bool>()), Times.Once);
            _splitsWorker.Verify(mock => mock.Stop(), Times.Once);
            _segmentsWorker.Verify(mock => mock.Stop(), Times.Once);
        }