Exemplo n.º 1
0
        public void TestMobileHits()
        {
            var m = new Mobile(0x1);

            m.DefaultMobileInit();

            var data = new MobileHits(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, false);

            AssertThat.Equal(data, expectedData);
        }
Exemplo n.º 2
0
        public void TestMobileHits()
        {
            var m = new Mobile(0x1);

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

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

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

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

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