Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Nunit 中,作为测试的一部分,我必须启动一个应用程序让它运行 1 分钟而不是停止它,然后它从文件中读取结果并断言值是否正确。我可以使用 Process.Start("app.exe"); 启动和停止应用程序;但是我不确定如何让它在 [Test] 中运行 x 秒。知道该怎么做吗?谢谢
[Test] void TestFiles() { using(var process = Process.Start("app.exe")) { Thread.Sleep(1000); process.Kill(); process.WaitForExit(); } // Check your files now }