Exemplo n.º 1
0
        public void send_message()
        {
            var    slice    = new BufferSlice(new byte[65535], 0, 65535);
            var    encoder  = new FakeEncoder();
            var    decoder  = new FakeDecoder();
            object expected = null;

            var sut = new TcpChannel(slice, encoder, decoder);

            sut.MessageReceived += (channel, message) => expected = message;
            sut.Assign(_helper.Client);
            sut.Send("Hello world");
        }
        public void should_listen_on_the_decoder_event()
        {
            var slice = new BufferSlice(new byte[65535], 0, 65535);
            var encoder = Substitute.For<IMessageEncoder>();
            var decoder = new FakeDecoder();
            object expected = null;

            var sut = new TcpChannel(slice, encoder, decoder);
            sut.MessageReceived += (channel, message) => expected = message;
            decoder.MessageReceived("Hello");

            expected.Should().Be("Hello");
        }
Exemplo n.º 3
0
        public void should_listen_on_the_decoder_event()
        {
            var    slice    = new BufferSlice(new byte[65535], 0, 65535);
            var    encoder  = Substitute.For <IMessageEncoder>();
            var    decoder  = new FakeDecoder();
            object expected = null;

            var sut = new TcpChannel(slice, encoder, decoder);

            sut.MessageReceived += (channel, message) => expected = message;
            decoder.MessageReceived("Hello");

            expected.Should().Be("Hello");
        }
        public void send_message()
        {
            var slice = new BufferSlice(new byte[65535], 0, 65535);
            var encoder = new FakeEncoder();
            var decoder = new FakeDecoder();
            object expected = null;

            var sut = new TcpChannel(slice, encoder, decoder);
            sut.MessageReceived += (channel, message) => expected = message;
            sut.Assign(_helper.Client);
            sut.Send("Hello world");

            
        }
        public void should_listen_on_the_decoder_event()
        {
            var slice = new BufferSlice(new byte[65535], 0, 65535);
            var encoder = Substitute.For<IMessageEncoder>();
            var decoder = new FakeDecoder();
            object expected = null;
            var stream = new SslStream(new NetworkStream(_helper.Server));
            stream.BeginAuthenticateAsServer(_certificate, OnAuthenticated, stream);

            var sut = CreateClientChannel(slice, encoder, decoder);
            sut.MessageReceived += (channel, message) => expected = message;
            decoder.MessageReceived("Hello");

            expected.Should().Be("Hello");
        }
Exemplo n.º 6
0
        public void should_listen_on_the_decoder_event()
        {
            var    slice    = new BufferSlice(new byte[65535], 0, 65535);
            var    encoder  = Substitute.For <IMessageEncoder>();
            var    decoder  = new FakeDecoder();
            object expected = null;
            var    stream   = new SslStream(new NetworkStream(_helper.Server));

            stream.BeginAuthenticateAsServer(_certificate, OnAuthenticated, stream);

            var sut = CreateClientChannel(slice, encoder, decoder);

            sut.MessageReceived += (channel, message) => expected = message;
            decoder.MessageReceived("Hello");

            expected.Should().Be("Hello");
        }