Add reasonable timeout to AutoResetEvent

- Issue MatterHackers/MCCentral#2637
TuningAdjustmentsDefaultToOneAndPersists hangs test suite, violates test
timeout
This commit is contained in:
John Lewin 2018-02-01 20:57:54 -08:00
parent 71b0b9bf43
commit 54ceb8170c

View file

@ -354,7 +354,10 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Wait for printing to complete
var printFinishedResetEvent = new AutoResetEvent(false);
ApplicationController.Instance.ActivePrinter.Connection.PrintFinished.RegisterEvent((s, e) => printFinishedResetEvent.Set(), ref unregisterEvents);
ApplicationController.Instance.ActivePrinter.Connection.PrintFinished.RegisterEvent((s, e) =>
{
printFinishedResetEvent.Set();
}, ref unregisterEvents);
testRunner.StartPrint();
@ -393,7 +396,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
printFinishedResetEvent.WaitOne();
// Wait up to 60 seconds for the print to finish
printFinishedResetEvent.WaitOne(60 * 1000);
// Values should match entered values
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);