NetworkWriterTest: empty arraysegment

This commit is contained in:
vis2k 2021-08-08 13:29:13 +08:00
parent a76fa59fee
commit 9dd1420edf

View File

@ -513,6 +513,16 @@ public void TestToArraySegment()
Assert.That(reader.ReadString(), Is.EqualTo("world"));
}
// sometimes we may serialize nothing, then call ToArraySegment.
// make sure this works even if empty.
[Test]
public void TestToArraySegment_EmptyContent()
{
NetworkWriter writer = new NetworkWriter();
ArraySegment<byte> segment = writer.ToArraySegment();
Assert.That(segment.Count, Is.EqualTo(0));
}
[Test]
public void TestChar()
{