From f59af28ccb01bae7ff262767ea0b4a37ebe1210a Mon Sep 17 00:00:00 2001 From: vis2k Date: Thu, 8 Oct 2020 11:02:09 +0200 Subject: [PATCH] MessagePacker.Unpack moved to MessagePackerTests because it's only used for tests --- Assets/Mirror/Runtime/MessagePacker.cs | 16 ---- Assets/Mirror/Tests/Editor/BuiltInMessages.cs | 26 +++--- Assets/Mirror/Tests/Editor/CustomRWTest.cs | 2 +- .../Generated/CollectionWriterTests.gen.cs | 90 +++++++++---------- .../Mirror/Tests/Editor/MessagePackerTest.cs | 22 ++++- .../Editor/ScriptableObjectWriterTest.cs | 2 +- .../Settings.json | 13 ++- 7 files changed, 91 insertions(+), 80 deletions(-) diff --git a/Assets/Mirror/Runtime/MessagePacker.cs b/Assets/Mirror/Runtime/MessagePacker.cs index 1b7080cb9..51676f60b 100644 --- a/Assets/Mirror/Runtime/MessagePacker.cs +++ b/Assets/Mirror/Runtime/MessagePacker.cs @@ -42,22 +42,6 @@ public static void Pack(T message, NetworkWriter writer) writer.Write(message); } - // unpack a message we received - public static T Unpack(byte[] data) - where T : struct, NetworkMessage - { - using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(data)) - { - int msgType = GetId(); - - int id = networkReader.ReadUInt16(); - if (id != msgType) - throw new FormatException("Invalid message, could not unpack " + typeof(T).FullName); - - return networkReader.Read(); - } - } - // unpack message after receiving // -> pass NetworkReader so it's less strange if we create it in here // and pass it upwards. diff --git a/Assets/Mirror/Tests/Editor/BuiltInMessages.cs b/Assets/Mirror/Tests/Editor/BuiltInMessages.cs index f47e6eccf..f84212d56 100644 --- a/Assets/Mirror/Tests/Editor/BuiltInMessages.cs +++ b/Assets/Mirror/Tests/Editor/BuiltInMessages.cs @@ -20,7 +20,7 @@ public void CommandMessage() byte[] arr = MessagePackerTest.PackToByteArray(message); // deserialize the same data - do we get the same result? - CommandMessage fresh = MessagePacker.Unpack(arr); + CommandMessage fresh = MessagePackerTest.Unpack(arr); Assert.That(fresh.netId, Is.EqualTo(message.netId)); Assert.That(fresh.componentIndex, Is.EqualTo(message.componentIndex)); Assert.That(fresh.functionHash, Is.EqualTo(message.functionHash)); @@ -38,7 +38,7 @@ public void ConnectMessage() byte[] arr = MessagePackerTest.PackToByteArray(message); Assert.DoesNotThrow(() => { - MessagePacker.Unpack(arr); + MessagePackerTest.Unpack(arr); }); } @@ -50,7 +50,7 @@ public void DisconnectMessage() byte[] arr = MessagePackerTest.PackToByteArray(message); Assert.DoesNotThrow(() => { - MessagePacker.Unpack(arr); + MessagePackerTest.Unpack(arr); }); } @@ -60,7 +60,7 @@ public void ErrorMessage() // try setting value with constructor ErrorMessage message = new ErrorMessage(42); byte[] arr = MessagePackerTest.PackToByteArray(message); - ErrorMessage fresh = MessagePacker.Unpack(arr); + ErrorMessage fresh = MessagePackerTest.Unpack(arr); Assert.That(fresh.value, Is.EqualTo(message.value)); } @@ -70,7 +70,7 @@ public void NetworkPingMessage() // try setting value with constructor NetworkPingMessage message = new NetworkPingMessage(DateTime.Now.ToOADate()); byte[] arr = MessagePackerTest.PackToByteArray(message); - NetworkPingMessage fresh = MessagePacker.Unpack(arr); + NetworkPingMessage fresh = MessagePackerTest.Unpack(arr); Assert.That(fresh.clientTime, Is.EqualTo(message.clientTime)); } @@ -84,7 +84,7 @@ public void NetworkPongMessage() serverTime = DateTime.Now.ToOADate(), }; byte[] arr = MessagePackerTest.PackToByteArray(message); - NetworkPongMessage fresh = MessagePacker.Unpack(arr); + NetworkPongMessage fresh = MessagePackerTest.Unpack(arr); Assert.That(fresh.clientTime, Is.EqualTo(message.clientTime)); Assert.That(fresh.serverTime, Is.EqualTo(message.serverTime)); } @@ -97,7 +97,7 @@ public void NotReadyMessage() byte[] arr = MessagePackerTest.PackToByteArray(message); Assert.DoesNotThrow(() => { - NotReadyMessage fresh = MessagePacker.Unpack(arr); + NotReadyMessage fresh = MessagePackerTest.Unpack(arr); }); } @@ -110,7 +110,7 @@ public void ObjectDestroyMessage() netId = 42, }; byte[] arr = MessagePackerTest.PackToByteArray(message); - ObjectDestroyMessage fresh = MessagePacker.Unpack(arr); + ObjectDestroyMessage fresh = MessagePackerTest.Unpack(arr); Assert.That(fresh.netId, Is.EqualTo(message.netId)); } @@ -123,7 +123,7 @@ public void ObjectHideMessage() netId = 42, }; byte[] arr = MessagePackerTest.PackToByteArray(message); - ObjectHideMessage fresh = MessagePacker.Unpack(arr); + ObjectHideMessage fresh = MessagePackerTest.Unpack(arr); Assert.That(fresh.netId, Is.EqualTo(message.netId)); } @@ -135,7 +135,7 @@ public void ReadyMessage() byte[] arr = MessagePackerTest.PackToByteArray(message); Assert.DoesNotThrow(() => { - ReadyMessage fresh = MessagePacker.Unpack(arr); + ReadyMessage fresh = MessagePackerTest.Unpack(arr); }); } @@ -151,7 +151,7 @@ public void RpcMessage() payload = new ArraySegment(new byte[] { 0x01, 0x02 }) }; byte[] arr = MessagePackerTest.PackToByteArray(message); - RpcMessage fresh = MessagePacker.Unpack(arr); + RpcMessage fresh = MessagePackerTest.Unpack(arr); Assert.That(fresh.netId, Is.EqualTo(message.netId)); Assert.That(fresh.componentIndex, Is.EqualTo(message.componentIndex)); Assert.That(fresh.functionHash, Is.EqualTo(message.functionHash)); @@ -183,7 +183,7 @@ void DoTest(ulong testSceneId) payload = new ArraySegment(new byte[] { 0x01, 0x02 }) }; byte[] arr = MessagePackerTest.PackToByteArray(message); - SpawnMessage fresh = MessagePacker.Unpack(arr); + SpawnMessage fresh = MessagePackerTest.Unpack(arr); Assert.That(fresh.netId, Is.EqualTo(message.netId)); Assert.That(fresh.isLocalPlayer, Is.EqualTo(message.isLocalPlayer)); Assert.That(fresh.isOwner, Is.EqualTo(message.isOwner)); @@ -210,7 +210,7 @@ public void UpdateVarsMessage() payload = new ArraySegment(new byte[] { 0x01, 0x02 }) }; byte[] arr = MessagePackerTest.PackToByteArray(message); - UpdateVarsMessage fresh = MessagePacker.Unpack(arr); + UpdateVarsMessage fresh = MessagePackerTest.Unpack(arr); Assert.That(fresh.netId, Is.EqualTo(message.netId)); Assert.That(fresh.payload.Count, Is.EqualTo(message.payload.Count)); for (int i = 0; i < fresh.payload.Count; ++i) diff --git a/Assets/Mirror/Tests/Editor/CustomRWTest.cs b/Assets/Mirror/Tests/Editor/CustomRWTest.cs index fad38fabf..3fc7138bc 100644 --- a/Assets/Mirror/Tests/Editor/CustomRWTest.cs +++ b/Assets/Mirror/Tests/Editor/CustomRWTest.cs @@ -48,7 +48,7 @@ public void TestCustomRW() byte[] data = MessagePackerTest.PackToByteArray(message); - QuestMessage unpacked = MessagePacker.Unpack(data); + QuestMessage unpacked = MessagePackerTest.Unpack(data); Assert.That(unpacked.quest.Id, Is.EqualTo(100)); } diff --git a/Assets/Mirror/Tests/Editor/Generated/CollectionWriterTests.gen.cs b/Assets/Mirror/Tests/Editor/Generated/CollectionWriterTests.gen.cs index 4411d04bb..b9ce80a38 100644 --- a/Assets/Mirror/Tests/Editor/Generated/CollectionWriterTests.gen.cs +++ b/Assets/Mirror/Tests/Editor/Generated/CollectionWriterTests.gen.cs @@ -25,7 +25,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); int[] unpackedCollection = unpacked.collection; Assert.That(unpackedCollection, Is.Null.Or.Empty); @@ -41,7 +41,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); int[] unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -61,7 +61,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); int[] unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -89,7 +89,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); string[] unpackedCollection = unpacked.collection; Assert.That(unpackedCollection, Is.Null.Or.Empty); @@ -105,7 +105,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); string[] unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -125,7 +125,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); string[] unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -153,7 +153,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); Vector3[] unpackedCollection = unpacked.collection; Assert.That(unpackedCollection, Is.Null.Or.Empty); @@ -169,7 +169,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); Vector3[] unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -189,7 +189,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); Vector3[] unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -217,7 +217,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); FloatStringStruct[] unpackedCollection = unpacked.collection; Assert.That(unpackedCollection, Is.Null.Or.Empty); @@ -233,7 +233,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); FloatStringStruct[] unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -253,7 +253,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); FloatStringStruct[] unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -281,7 +281,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ClassWithNoConstructor[] unpackedCollection = unpacked.collection; Assert.That(unpackedCollection, Is.Null.Or.Empty); @@ -297,7 +297,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ClassWithNoConstructor[] unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -317,7 +317,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ClassWithNoConstructor[] unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -345,7 +345,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.That(unpackedCollection.Array, Is.Null.Or.Empty); @@ -368,7 +368,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection.Array); @@ -395,7 +395,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection.Array); @@ -423,7 +423,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.That(unpackedCollection.Array, Is.Null.Or.Empty); @@ -446,7 +446,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection.Array); @@ -473,7 +473,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection.Array); @@ -501,7 +501,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.That(unpackedCollection.Array, Is.Null.Or.Empty); @@ -524,7 +524,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection.Array); @@ -551,7 +551,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection.Array); @@ -579,7 +579,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.That(unpackedCollection.Array, Is.Null.Or.Empty); @@ -602,7 +602,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection.Array); @@ -629,7 +629,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection.Array); @@ -657,7 +657,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.That(unpackedCollection.Array, Is.Null.Or.Empty); @@ -680,7 +680,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection.Array); @@ -707,7 +707,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); ArraySegment unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection.Array); @@ -735,7 +735,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.That(unpackedCollection, Is.Null.Or.Empty); @@ -751,7 +751,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -771,7 +771,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -799,7 +799,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.That(unpackedCollection, Is.Null.Or.Empty); @@ -815,7 +815,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -835,7 +835,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -863,7 +863,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.That(unpackedCollection, Is.Null.Or.Empty); @@ -879,7 +879,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -899,7 +899,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -927,7 +927,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.That(unpackedCollection, Is.Null.Or.Empty); @@ -943,7 +943,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -963,7 +963,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -991,7 +991,7 @@ public void SendsNull() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.That(unpackedCollection, Is.Null.Or.Empty); @@ -1007,7 +1007,7 @@ public void SendsEmpty() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); @@ -1027,7 +1027,7 @@ public void SendsData() byte[] data = MessagePackerTest.PackToByteArray(message); - Message unpacked = MessagePacker.Unpack(data); + Message unpacked = MessagePackerTest.Unpack(data); List unpackedCollection = unpacked.collection; Assert.IsNotNull(unpackedCollection); diff --git a/Assets/Mirror/Tests/Editor/MessagePackerTest.cs b/Assets/Mirror/Tests/Editor/MessagePackerTest.cs index 011addd55..d03748a0d 100644 --- a/Assets/Mirror/Tests/Editor/MessagePackerTest.cs +++ b/Assets/Mirror/Tests/Editor/MessagePackerTest.cs @@ -23,6 +23,22 @@ public static byte[] PackToByteArray(T message) where T : struct, NetworkMess } } + // this was previously in MessagePacker, but we only need it for tests + public static T Unpack(byte[] data) + where T : struct, NetworkMessage + { + using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(data)) + { + int msgType = MessagePacker.GetId(); + + int id = networkReader.ReadUInt16(); + if (id != msgType) + throw new FormatException("Invalid message, could not unpack " + typeof(T).FullName); + + return networkReader.Read(); + } + } + [Test] public void TestPacking() { @@ -34,7 +50,7 @@ public void TestPacking() byte[] data = PackToByteArray(message); - TestMessage unpacked = MessagePacker.Unpack(data); + TestMessage unpacked = Unpack(data); Assert.That(unpacked.sceneName, Is.EqualTo("Hello world")); Assert.That(unpacked.sceneOperation, Is.EqualTo(SceneOperation.LoadAdditive)); @@ -49,7 +65,7 @@ public void UnpackWrongMessage() Assert.Throws(() => { - DisconnectMessage unpacked = MessagePacker.Unpack(data); + DisconnectMessage unpacked = Unpack(data); }); } @@ -73,7 +89,7 @@ public void TestUnpackIdMismatch() Assert.Throws(() => { - TestMessage unpacked = MessagePacker.Unpack(data); + TestMessage unpacked = Unpack(data); }); } diff --git a/Assets/Mirror/Tests/Editor/ScriptableObjectWriterTest.cs b/Assets/Mirror/Tests/Editor/ScriptableObjectWriterTest.cs index 8b5cdbcd9..1f1e7eb5a 100644 --- a/Assets/Mirror/Tests/Editor/ScriptableObjectWriterTest.cs +++ b/Assets/Mirror/Tests/Editor/ScriptableObjectWriterTest.cs @@ -33,7 +33,7 @@ public void TestWriteScriptableObject() byte[] data = MessagePackerTest.PackToByteArray(message); - ScriptableObjectMessage unpacked = MessagePacker.Unpack(data); + ScriptableObjectMessage unpacked = MessagePackerTest.Unpack(data); Assert.That(unpacked.scriptableObject, Is.Not.Null); Assert.That(unpacked.scriptableObject.someData, Is.EqualTo(10)); diff --git a/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json b/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json index ad11087f4..8239cca44 100644 --- a/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json +++ b/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json @@ -2,6 +2,17 @@ "m_Name": "Settings", "m_Path": "ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json", "m_Dictionary": { - "m_DictionaryValues": [] + "m_DictionaryValues": [ + { + "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "Path", + "value": "{\"m_Value\":\"/Users/qwerty/x/dev/project_Mirror/Repository\"}" + }, + { + "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "HistoryPath", + "value": "{\"m_Value\":\"/Users/qwerty/x/dev/project_Mirror/Repository\"}" + } + ] } } \ No newline at end of file