public void TestMobileAttributesN() { var m = new Mobile(0x1); m.DefaultMobileInit(); var data = new MobileAttributesN(m).Compile(); Span <byte> expectedData = stackalloc byte[17]; var pos = 0; expectedData.Write(ref pos, (byte)0x2D); // Packet ID expectedData.Write(ref pos, m.Serial); expectedData.WriteAttribute(ref pos, m.Hits, m.HitsMax, true); expectedData.WriteAttribute(ref pos, m.Mana, m.ManaMax, true); expectedData.WriteAttribute(ref pos, m.Stam, m.StamMax, true); AssertThat.Equal(data, expectedData); }
public void TestMobileAttributesN() { var m = new Mobile(0x1); m.DefaultMobileInit(); m.Str = 50; m.Hits = 100; m.Int = 75; m.Mana = 100; m.Dex = 25; m.Stam = 100; var expected = new MobileAttributesN(m).Compile(); using var ns = PacketTestUtilities.CreateTestNetState(); ns.SendMobileAttributes(m, true); var result = ns.SendPipe.Reader.TryRead(); AssertThat.Equal(result.Buffer[0].AsSpan(0), expected); }