public void TestScrollMessage(int type, int tip, string text)
        {
            var expected = new ScrollMessage(type, tip, text).Compile();

            using var ns = PacketTestUtilities.CreateTestNetState();
            ns.SendScrollMessage(type, tip, text);

            var result = ns.SendPipe.Reader.TryRead();

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }
Exemple #2
0
        public void TestScrollMessage(int type, int tip, string text)
        {
            var data = new ScrollMessage(type, tip, text).Compile();

            text ??= "";
            var         length       = 10 + text.Length;
            Span <byte> expectedData = stackalloc byte[length];
            var         pos          = 0;

            expectedData.Write(ref pos, (byte)0xA6);     // Packet ID
            expectedData.Write(ref pos, (ushort)length); // Length
            expectedData.Write(ref pos, (byte)type);
            expectedData.Write(ref pos, tip);
            expectedData.Write(ref pos, (ushort)text.Length);
            expectedData.WriteAscii(ref pos, text);

            AssertThat.Equal(data, expectedData);
        }