예제 #1
0
        public void CanConnectPlugToSocket()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket = new Socket<IAudioStream>();

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

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

            plug.ConnectTo(socket);
            socket.IsConnected.Should().Be.True();
        }
예제 #4
0
        public void CannotConnectToNewSocketWithoutDisconnecting()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket1 = new Socket<IAudioStream>();
            var socket2 = new Socket<IAudioStream>();

            plug.ConnectTo(socket1);

            plug.ConnectTo(socket2).Should().Be.False();
        }
예제 #5
0
        public void DisconnectingPlugDisconnectsSocket()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket = new Socket<IAudioStream>();

            plug.ConnectTo(socket);

            plug.Disconnect();
            socket.IsConnected.Should().Be.False();
        }
예제 #6
0
        public void CannotConnectNewPlugWithoutDisconnecting()
        {
            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>();

            plug1.ConnectTo(socket);

            plug2.ConnectTo(socket).Should().Be.False();
        }