Multiplex Test: reuse CreateGameObject with component

This commit is contained in:
vis2k 2021-08-07 13:44:52 +08:00
parent 70f117a950
commit 3350760edb

View File

@ -1,38 +1,29 @@
using System;
using NSubstitute;
using NUnit.Framework;
using UnityEngine;
namespace Mirror.Tests
{
public class MultiplexTest
public class MultiplexTest : MirrorTest
{
Transport transport1;
Transport transport2;
MultiplexTransport transport;
new MultiplexTransport transport;
[SetUp]
public void Setup()
{
base.SetUp();
CreateGameObject(out _, out transport);
transport1 = Substitute.For<Transport>();
transport2 = Substitute.For<Transport>();
GameObject gameObject = new GameObject();
transport = gameObject.AddComponent<MultiplexTransport>();
transport.transports = new[] { transport1, transport2 };
transport.Awake();
}
[TearDown]
public void TearDown()
{
GameObject.DestroyImmediate(transport.gameObject);
}
#region Client tests
// A Test behaves as an ordinary method
[Test]
public void TestAvailable()
@ -165,10 +156,6 @@ public void TestClient2Connected()
callback.Received().Invoke();
}
#endregion
#region Server tests
[Test]
public void TestServerConnected()
{
@ -189,9 +176,5 @@ void SendMessage(int connectionId)
transport1.Received().ServerSend(1, segment, 5);
}
#endregion
}
}