public void TestChangeUpdateRange(int range) { var expected = new ChangeUpdateRange(range).Compile(); using var ns = PacketTestUtilities.CreateTestNetState(); ns.SendChangeUpdateRange((byte)range); var result = ns.SendPipe.Reader.TryRead(); AssertThat.Equal(result.Buffer[0].AsSpan(0), expected); }
public void TestChangeUpdateRange() { byte range = 10; var data = new ChangeUpdateRange(range).Compile(); Span <byte> expectedData = stackalloc byte[2]; var pos = 0; expectedData.Write(ref pos, (byte)0xC8); // Packet ID expectedData.Write(ref pos, range); AssertThat.Equal(data, expectedData); }
public static ChangeUpdateRange Instantiate(int range) { var idx = (byte)range; var p = m_Cache[idx]; if (p == null) { m_Cache[idx] = p = new ChangeUpdateRange(range); p.SetStatic(); } return(p); }