Пример #1
0
        public void TestPathfindMessage(int x, int y, int z)
        {
            var p        = new Point3D(x, y, z);
            var expected = new PathfindMessage(p).Compile();

            using var ns = PacketTestUtilities.CreateTestNetState();
            ns.SendPathfindMessage(p);

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

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }
Пример #2
0
        public void TestPathfindMessage()
        {
            var p    = new Point3D(1000, 10, 1);
            var data = new PathfindMessage(p).Compile();

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

            expectedData.Write(ref pos, (byte)0x38); // Packet ID
            expectedData.Write(ref pos, (ushort)p.X);
            expectedData.Write(ref pos, (ushort)p.Y);
            expectedData.Write(ref pos, (short)p.Z);

            AssertThat.Equal(data, expectedData);
        }