From ca166bd95f3ddb5f73404508695174c60a6b73ca Mon Sep 17 00:00:00 2001 From: Lymdun <6077630+Lymdun@users.noreply.github.com> Date: Mon, 2 Mar 2020 22:41:27 +0100 Subject: [PATCH] Improve LocalConnectionTest (#1538) --- Assets/Mirror/Tests/Editor/LocalConnectionTest.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Assets/Mirror/Tests/Editor/LocalConnectionTest.cs b/Assets/Mirror/Tests/Editor/LocalConnectionTest.cs index ff7348bfd..e69ea5022 100644 --- a/Assets/Mirror/Tests/Editor/LocalConnectionTest.cs +++ b/Assets/Mirror/Tests/Editor/LocalConnectionTest.cs @@ -1,5 +1,7 @@ +using System; using System.Collections.Generic; using NUnit.Framework; +using UnityEngine.TestTools; namespace Mirror.Tests { @@ -34,6 +36,8 @@ public void Disconnect() [Test] public void ServerToClientTest() { + Assert.That(connectionToClient.address, Is.EqualTo("localhost")); + MyMessage myMessage = new MyMessage() { id = 3, @@ -64,6 +68,8 @@ void handler(NetworkMessage msg) [Test] public void ClientToServerTest() { + Assert.That(connectionToServer.address, Is.EqualTo("localhost")); + MyMessage myMessage = new MyMessage() { id = 3, @@ -91,5 +97,14 @@ void handler(NetworkMessage msg) Assert.True(invoked, "handler should have been invoked"); } + [Test] + public void ClientToServerFailTest() + { + LogAssert.ignoreFailingMessages = true; // error log is expected + bool result = connectionToServer.Send(new ArraySegment(new byte[0])); + LogAssert.ignoreFailingMessages = false; + + Assert.That(result, Is.False); + } } }