예제 #1
0
        public void TestMobileHitsN()
        {
            var m = new Mobile(0x1);

            m.DefaultMobileInit();

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

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

            expectedData.Write(ref pos, (byte)0xA1); // Packet ID
            expectedData.Write(ref pos, m.Serial);
            expectedData.WriteAttribute(ref pos, m.Hits, m.HitsMax, true);

            AssertThat.Equal(data, expectedData);
        }
예제 #2
0
        public void TestMobileHitsN()
        {
            var m = new Mobile(0x1);

            m.DefaultMobileInit();
            m.Str  = 100;
            m.Hits = 100;

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

            using var ns = PacketTestUtilities.CreateTestNetState();
            ns.SendMobileHits(m, true);

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

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }