示例#1
0
        public void TestCancelArrowHS(int x, int y)
        {
            Serial serial = 0x1024;

            var expected = new CancelArrowHS(x, y, serial).Compile();

            using var ns       = PacketTestUtilities.CreateTestNetState();
            ns.ProtocolChanges = ProtocolChanges.HighSeas;
            ns.SendCancelArrow(x, y, serial);

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

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }
示例#2
0
        public void TestCancelArrowHS(int x, int y)
        {
            Span <byte> data = new CancelArrowHS(x, y, 0x1).Compile();

            Span <byte> expectedData = stackalloc byte[]
            {
                0xBA,                  // Packet
                0x00,                  // Command
                0x00, 0x00,            // X
                0x00, 0x00,            // Y
                0x00, 0x00, 0x00, 0x01 // Serial
            };

            ((ushort)x).CopyTo(expectedData.Slice(2, 2));
            ((ushort)y).CopyTo(expectedData.Slice(4, 2));

            AssertThat.Equal(data, expectedData);
        }
示例#3
0
        public void TestCancelArrowHS(int x, int y)
        {
            Serial serial = 0x01;
            var    data   = new CancelArrowHS(x, y, serial).Compile();

            Span <byte> expectedData = stackalloc byte[10];
            var         pos          = 0;

            expectedData.Write(ref pos, (byte)0xBA); // Packet ID
#if NO_LOCAL_INIT
            expectedData.Write(ref pos, (byte)0);    // Command
#else
            pos++;
#endif
            expectedData.Write(ref pos, (ushort)x);
            expectedData.Write(ref pos, (ushort)y);
            expectedData.Write(ref pos, serial);

            AssertThat.Equal(data, expectedData);
        }