test that we cannot unpack the wrong message

This commit is contained in:
Paul Pacheco 2020-03-24 10:37:54 -05:00
parent a7ab26fa7d
commit e8c9d7951d

View File

@ -22,6 +22,19 @@ public void TestPacking()
Assert.That(unpacked.sceneOperation, Is.EqualTo(SceneOperation.LoadAdditive)); Assert.That(unpacked.sceneOperation, Is.EqualTo(SceneOperation.LoadAdditive));
} }
[Test]
public void UnpackWrongMessage()
{
ConnectMessage message = new ConnectMessage();
byte[] data = MessagePacker.Pack(message);
Assert.Throws<FormatException>(() =>
{
DisconnectMessage unpacked = MessagePacker.Unpack<DisconnectMessage>(data);
});
}
[Test] [Test]
public void TestUnpackIdMismatch() public void TestUnpackIdMismatch()
{ {