/// <summary> /// Creates a controller for the network client and instantiate the world with this controller. This action is the last before the start. /// </summary> /// <param name="data"></param> public void InstantiateWorld(NetworkServerData data) { var factory = new SoloNetworkControllerFactory(data.ClientOnServerSide); var configuration = new Configuration { LoadingData = data.LoadingData, Settings = data.Settings }; data.World = CreateWorld(configuration, factory, data.WorldState); data.World.Exit += () => { if (data != null) data.Close(); }; }
/// <summary> /// Runs the test as a Unit test. /// </summary> /// <param name="assemblyName"></param> /// <param name="level"></param> /// <param name="testName"></param> /// <param name="asserter"></param> public void RunSelfTestInVSContext(string assemblyName, string level, string testName, IAsserter asserter) { var holder = new NetworkServerData(); holder.Port = DefaultPort; holder.LoadingData = new LoadingData { AssemblyName = assemblyName, Level = level }; var test = GetTest(holder.LoadingData, testName); var thread = new Thread(() => { var proposal = new SettingsProposal { SpeedUp = true }; CreateSelfTestServer(holder, proposal); holder.World.RunActively(1); holder.Close(); }) { IsBackground = true }; thread.Start(); try { SelfTestClientThread(test, asserter, holder); } catch (Exception e) { throw e; } finally { holder.Close(); } }