private TestOsuGameBase loadOsu(GameHost host, bool withBeatmap = false) { var osu = new TestOsuGameBase(withBeatmap); #pragma warning disable 4014 Task.Run(() => host.Run(osu)); #pragma warning restore 4014 waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time"); return(osu); }
protected virtual TestOsuGameBase LoadOsuIntoHost(GameHost host, bool withBeatmap = false) { var osu = new TestOsuGameBase(withBeatmap); Task.Run(() => host.Run(osu)); waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time"); bool ready = false; // wait for two update frames to be executed. this ensures that all components have had a change to run LoadComplete and hopefully avoid // database access (GlobalActionContainer is one to do this). host.UpdateThread.Scheduler.Add(() => host.UpdateThread.Scheduler.Add(() => ready = true)); waitForOrAssert(() => ready, @"osu! failed to start in a reasonable amount of time"); return(osu); }
protected virtual TestOsuGameBase LoadOsuIntoHost(GameHost host, bool withBeatmap = false) { var osu = new TestOsuGameBase(withBeatmap); Task.Factory.StartNew(() => host.Run(osu), TaskCreationOptions.LongRunning) .ContinueWith(t => Assert.Fail($"Host threw exception {t.Exception}"), TaskContinuationOptions.OnlyOnFaulted); waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time"); bool ready = false; // wait for two update frames to be executed. this ensures that all components have had a change to run LoadComplete and hopefully avoid // database access (GlobalActionContainer is one to do this). host.UpdateThread.Scheduler.Add(() => host.UpdateThread.Scheduler.Add(() => ready = true)); waitForOrAssert(() => ready, @"osu! failed to start in a reasonable amount of time"); return(osu); }
private static async Task importCollectionsFromStream(TestOsuGameBase osu, Stream stream) { // intentionally spin this up on a separate task to avoid disposal deadlocks. // see https://github.com/EventStore/EventStore/issues/1179 await Task.Run(() => osu.CollectionManager.Import(stream).Wait()); }
private static async Task importCollectionsFromStream(TestOsuGameBase osu, Stream stream) { // intentionally spin this up on a separate task to avoid disposal deadlocks. // see https://github.com/EventStore/EventStore/issues/1179 await Task.Factory.StartNew(() => osu.CollectionManager.Import(stream).WaitSafely(), TaskCreationOptions.LongRunning); }