Example #1
0
        public void TestMobileName(string name)
        {
            var m = new Mobile(0x1)
            {
                Name = name
            };

            m.DefaultMobileInit();

            var expected = new MobileName(m).Compile();

            using var ns = PacketTestUtilities.CreateTestNetState();
            ns.SendMobileName(m);

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

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }
Example #2
0
        public void TestMobileName()
        {
            var m = new Mobile(0x1)
            {
                Name = "Some Really Long Mobile Name That Gets Cut off"
            };

            m.DefaultMobileInit();

            var data = new MobileName(m).Compile();

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

            expectedData.Write(ref pos, (byte)0x98);
            expectedData.Write(ref pos, (ushort)0x25);
            expectedData.Write(ref pos, m.Serial);
            expectedData.WriteAsciiFixed(ref pos, m.Name ?? "", 29);
#if NO_LOCAL_INIT
            expectedData.Write(ref pos, (byte)0);
#endif

            AssertThat.Equal(data, expectedData);
        }