IEnumerator RunLocalTest(Action prepare, Func <bool> check, Action validate) { var server = new NetworkGameServer(typeof(T), new NetworkServerConfig { Port = 8888 }); Host = new NetworkHost { Server = server, Client = server.CreateLocalClient() }; int count = 0; while (Host.Server.Clients.Count <= 0) { Host.Update(); yield return(null); count++; } prepare(); for (var i = 0; i < 1000; i++) { Host.Update(); if (check()) { break; } yield return(null); } validate(); }
IEnumerator RunTest(Action prepare, Func <bool> check, Action validate) { Host = NetworkHost.Create(typeof(T), CreateHostConfig()); var connectTask = Host.Client.Connect( new NetworkConnectionConfig { IP = "localhost", Port = 8888 }); int count = 0; while (!connectTask.IsCompleted || Host.Server.Clients.Count <= 0) { Host.Update(); yield return(null); count++; } prepare(); for (var i = 0; i < 1000; i++) { Host.Update(); if (check()) { break; } yield return(null); } validate(); }