Пример #1
0
        public void SendToClientOfPlayerExceptionTest()
        {
            SimpleNetworkServer comp = serverPlayerGO.AddComponent <SimpleNetworkServer>();

            Assert.Throws <InvalidOperationException>(() =>
            {
                comp.SendToClientOfPlayer <ServerRpcMessage>(null, new ServerRpcMessage());
            });
        }
Пример #2
0
        public void SendToClientOfPlayerExceptionTest()
        {
            GameObject          gameObject = new GameObject();
            SimpleNetworkServer comp       = gameObject.AddComponent <SimpleNetworkServer>();

            Assert.Throws <InvalidOperationException>(() =>
            {
                comp.SendToClientOfPlayer <CommandMessage>(null, new CommandMessage());
            });
        }
Пример #3
0
        public void SpawnObjectExposeExceptionTest()
        {
            GameObject          gameObject = new GameObject();
            SimpleNetworkServer comp       = gameObject.AddComponent <SimpleNetworkServer>();

            GameObject obj = new GameObject();

            InvalidOperationException ex = Assert.Throws <InvalidOperationException>(() =>
            {
                comp.SpawnObjectExpose(obj, connectionToServer);
            });

            Assert.That(ex.Message, Is.EqualTo("SpawnObject for " + obj + ", NetworkServer is not active. Cannot spawn objects without an active server."));
        }