我有一个在不同线程中执行某些功能的类。我想在我的 MonoTouch 应用程序中测试这个类。所以我在测试项目中添加了一个测试夹具。我发现 MonoTouch 不会等待测试完成,它只是在测试用例仍在运行时说它“成功”。案例示例如下:
[Test]
public void ThreadTest()
{
Timer ApplicationTimer = new Timer {Enabled = true, Interval = 2500};
ApplicationTimer.Elapsed += ApplicationTimer_Tick;
}
private void ApplicationTimer_Tick (object sender, ElapsedEventArgs e)
{
Assert.Fail("failing"); // by the time the debugger hits this point, the UI already says that all tests passed. which is totally wrong.
}
任何帮助,将不胜感激。