Ejemplo n.º 1
0
        public async Task Step4_ShouldCloseChannel()
        {
            // Arrange
            var channelRequest = new ChannelRequest
            {
                RequestId = "623AE57B-9917-4DED-BFFC-44F09C906F10",
                ChannelId = _testChannel.Id
            };

            // Subscribe event
            ChannelSummaryResponse channelSummaryResponse = null;

            void OnChannelClosed(ChannelSummaryResponse response)
            {
                channelSummaryResponse = response;
            }

            _userSignalRClient.ChannelClosed += OnChannelClosed;

            // Act
            await _adminSignalRClient.CloseChannelAsync(channelRequest);

            // Unsubscribe events
            _userSignalRClient.ChannelClosed -= OnChannelClosed;

            // Assert
            channelSummaryResponse.IsClosed.Should().BeTrue();
        }
Ejemplo n.º 2
0
        public static async Task CloseChannelAsync(SignalRClient signalRClient, Guid channelId)
        {
            // Close the channel called test
            var closeChannelRequest = new ChannelRequest
            {
                ChannelId = channelId,
                RequestId = Guid.NewGuid().ToString()
            };

            Console.WriteLine("Closing the channel");
            await signalRClient.CloseChannelAsync(closeChannelRequest);

            Console.WriteLine("Channel was closed.");
            Console.WriteLine();
        }