public async Task when_gettting_channels_without_stream_then_fails()
        {
            var configuration         = new MqttConfiguration();
            var privateStreamListener = new Subject <PrivateStream> ();
            var provider = new PrivateChannelListener(privateStreamListener, configuration);

            var channelsCreated = 0;

            provider
            .GetChannelStream()
            .Subscribe(channel => {
                channelsCreated++;
            });

            await Task.Delay(TimeSpan.FromMilliseconds(1000));

            Assert.Equal(0, channelsCreated);
        }
Example #2
0
        public async Task when_gettting_channels_with_stream_then_succeeds()
        {
            MqttConfiguration       configuration         = new MqttConfiguration();
            Subject <PrivateStream> privateStreamListener = new Subject <PrivateStream>();
            PrivateChannelListener  provider = new PrivateChannelListener(privateStreamListener, configuration);

            int channelsCreated = 0;

            provider
            .GetChannelStream()
            .Subscribe(channel =>
            {
                channelsCreated++;
            });

            privateStreamListener.OnNext(new PrivateStream(configuration));
            privateStreamListener.OnNext(new PrivateStream(configuration));
            privateStreamListener.OnNext(new PrivateStream(configuration));

            await Task.Delay(TimeSpan.FromMilliseconds(1000));

            3.Should().Be(channelsCreated);
        }