From e8c9d7951dc757973b6035a790a306fdef226f80 Mon Sep 17 00:00:00 2001 From: Paul Pacheco Date: Tue, 24 Mar 2020 10:37:54 -0500 Subject: [PATCH] test that we cannot unpack the wrong message --- Assets/Mirror/Tests/Editor/MessagePackerTest.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Assets/Mirror/Tests/Editor/MessagePackerTest.cs b/Assets/Mirror/Tests/Editor/MessagePackerTest.cs index a1f8eee79..393d6573f 100644 --- a/Assets/Mirror/Tests/Editor/MessagePackerTest.cs +++ b/Assets/Mirror/Tests/Editor/MessagePackerTest.cs @@ -22,6 +22,19 @@ public void TestPacking() Assert.That(unpacked.sceneOperation, Is.EqualTo(SceneOperation.LoadAdditive)); } + [Test] + public void UnpackWrongMessage() + { + ConnectMessage message = new ConnectMessage(); + + byte[] data = MessagePacker.Pack(message); + + Assert.Throws(() => + { + DisconnectMessage unpacked = MessagePacker.Unpack(data); + }); + } + [Test] public void TestUnpackIdMismatch() {