public void TestDeathStatus(bool dead) { var expected = new DeathStatus(dead).Compile(); using var ns = PacketTestUtilities.CreateTestNetState(); ns.SendDeathStatus(dead); var result = ns.SendPipe.Reader.TryRead(); AssertThat.Equal(result.Buffer[0].AsSpan(0), expected); }
public void TestDeathStatus(bool isDead) { var data = new DeathStatus(isDead).Compile(); Span <byte> expectedData = stackalloc byte[2]; var pos = 0; const byte dead = 0; const byte alive = 2; expectedData.Write(ref pos, (byte)0x2C); // Packet ID expectedData.Write(ref pos, isDead ? dead : alive); AssertThat.Equal(data, expectedData); }