Simulate a delay in execution in Unit Test using Moq
问题 I'm trying to test the following: protected IHealthStatus VerifyMessage(ISubscriber destination) { var status = new HeartBeatStatus(); var task = new Task<CheckResult>(() => { Console.WriteLine("VerifyMessage(Start): {0} - {1}", DateTime.Now, WarningTimeout); Thread.Sleep(WarningTimeout - 500); Console.WriteLine("VerifyMessage(Success): {0}", DateTime.Now); if (CheckMessages(destination)) { return CheckResult.Success; } Console.WriteLine("VerifyMessage(Pre-Warning): {0} - {1}", DateTime.Now,