using System; using Mirror.Tests.RemoteAttrributeTest; using NUnit.Framework; namespace Mirror.Tests { public class NetworkWriterCollectionTest { [Test] public void HasWriteFunctionForInt() { Assert.That(Writer.write, Is.Not.Null, "int write function was not found"); Action action = NetworkWriterExtensions.WriteInt; Assert.That(Writer.write, Is.EqualTo(action), "int write function was incorrect value"); } [Test] public void HasReadFunctionForInt() { Assert.That(Reader.read, Is.Not.Null, "int read function was not found"); Func action = NetworkReaderExtensions.ReadInt; Assert.That(Reader.read, Is.EqualTo(action), "int read function was incorrect value"); } [Test] public void HasWriteNetworkBehaviourFunction() { Assert.That(Writer.write, Is.Not.Null, "NetworkBehaviour read function was not found"); Action action = NetworkWriterExtensions.WriteNetworkBehaviour; Assert.That(Writer.write, Is.EqualTo(action), "NetworkBehaviour read function was incorrect value"); } [Test] public void HasReadNetworkBehaviourFunction() { Assert.That(Reader.read, Is.Not.Null, "NetworkBehaviour read function was not found"); Func actionNonGeneric = NetworkReaderExtensions.ReadNetworkBehaviour; Func actionGeneric = NetworkReaderExtensions.ReadNetworkBehaviour; Assert.That(Reader.read, Is.EqualTo(actionNonGeneric).Or.EqualTo(actionGeneric), "NetworkBehaviour read function was incorrect value, should be generic or non-generic"); } [Test] public void HasWriteNetworkBehaviourDerivedFunction() { // needs a networkbehaviour that is included in an Message/Rpc/syncvar for this test Assert.That(Writer.write, Is.Not.Null, "RpcNetworkIdentityBehaviour read function was not found"); Action action = NetworkWriterExtensions.WriteNetworkBehaviour; Assert.That(Writer.write, Is.EqualTo(action), "RpcNetworkIdentityBehaviour read function was incorrect value"); } [Test] public void HasReadNetworkBehaviourDerivedFunction() { Func reader = Reader.read; Assert.That(reader, Is.Not.Null, "RpcNetworkIdentityBehaviour read function was not found"); Func action = NetworkReaderExtensions.ReadNetworkBehaviour; Assert.That(reader, Is.EqualTo(action), "RpcNetworkIdentityBehaviour read function was incorrect value"); } } }