コード例 #1
0
        public void send_simple_message()
        {
            var buf      = new SocketBufferFake();
            var expected = "Hello world!";

            var sut = new StringEncoder();

            sut.Prepare(expected);
            sut.Send(buf);

            BitConverter.ToInt32(buf.Buffer, 0).Should().Be(expected.Length);
            var actual = Encoding.UTF8.GetString(buf.Buffer, buf.BaseOffset + 4, buf.Count - 4);

            actual.Should().Be(expected);
        }