示例#1
0
        public void CanReconnectSameConnection()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket = new Socket<IAudioStream>();

            socket.ConnectTo(plug);

            socket.ConnectTo(plug).Should().Be.True();
        }
示例#2
0
        public void ConnectingSetsSocketChannel()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket = new Socket<IAudioStream>();

            socket.ConnectTo(plug);
            Assert.Same(stream, socket.Channel);
        }
示例#3
0
        public void ConnectedPlugIsConnected()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket = new Socket<IAudioStream>();

            socket.ConnectTo(plug);
            plug.IsConnected.Should().Be.True();
        }
示例#4
0
        public void CannotConnectToNewPlugWithoutDisconnecting()
        {
            var stream1 = Substitute.For<IAudioStream>();
            var plug1 = new Plug<IAudioStream>(stream1);
            var stream2 = Substitute.For<IAudioStream>();
            var plug2 = new Plug<IAudioStream>(stream2);
            var socket = new Socket<IAudioStream>();

            socket.ConnectTo(plug1);

            socket.ConnectTo(plug2).Should().Be.False();
        }
示例#5
0
        public void DisconnectingSocketDisconnectsPlug()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket = new Socket<IAudioStream>();

            socket.ConnectTo(plug);

            socket.Disconnect();
            plug.IsConnected.Should().Be.False();
        }
示例#6
0
        public void CannotConnectNewSocketWithoutDisconnecting()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket1 = new Socket<IAudioStream>();
            var socket2 = new Socket<IAudioStream>();

            socket1.ConnectTo(plug);

            socket2.ConnectTo(plug).Should().Be.False();
        }