public void QueryDatabase() { DatabaseEngine.DatabaseEngine.UnitTestEnvironment(); var result = DatabaseAPI.SetupConnection(0, Info); Assert.IsTrue(result); result = DatabaseAPI.Connect("UnitTest", "Test", "temp"); Assert.IsTrue(result); DatabaseAPI.ExecuteQuery("Test", "SELECT * FROM Tiles;", OnResult); var t = Task.Delay(-1, token.Token); //Required in test case so thread does not abort try { Task.WaitAll(t); } catch (AggregateException e) { } //Just to handle the cancel expcetion, which is what we want Assert.IsTrue(ResultSuccess); }