mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Improve LocalConnectionTest (#1538)
This commit is contained in:
parent
e9d4f04da5
commit
ca166bd95f
@ -1,5 +1,7 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
namespace Mirror.Tests
|
namespace Mirror.Tests
|
||||||
{
|
{
|
||||||
@ -34,6 +36,8 @@ public void Disconnect()
|
|||||||
[Test]
|
[Test]
|
||||||
public void ServerToClientTest()
|
public void ServerToClientTest()
|
||||||
{
|
{
|
||||||
|
Assert.That(connectionToClient.address, Is.EqualTo("localhost"));
|
||||||
|
|
||||||
MyMessage myMessage = new MyMessage()
|
MyMessage myMessage = new MyMessage()
|
||||||
{
|
{
|
||||||
id = 3,
|
id = 3,
|
||||||
@ -64,6 +68,8 @@ void handler(NetworkMessage msg)
|
|||||||
[Test]
|
[Test]
|
||||||
public void ClientToServerTest()
|
public void ClientToServerTest()
|
||||||
{
|
{
|
||||||
|
Assert.That(connectionToServer.address, Is.EqualTo("localhost"));
|
||||||
|
|
||||||
MyMessage myMessage = new MyMessage()
|
MyMessage myMessage = new MyMessage()
|
||||||
{
|
{
|
||||||
id = 3,
|
id = 3,
|
||||||
@ -91,5 +97,14 @@ void handler(NetworkMessage msg)
|
|||||||
Assert.True(invoked, "handler should have been invoked");
|
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<byte>(new byte[0]));
|
||||||
|
LogAssert.ignoreFailingMessages = false;
|
||||||
|
|
||||||
|
Assert.That(result, Is.False);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user