public async Task Test2() { // ARRANGE var dt = new DisposeTester(output); // ACT DelayedDisposer.SafelyDispose((IDisposable)dt); // ASSERT dt.CheckNegative(); await dt.WaitForDisposal(); dt.Check(); }
public async Task Test1() { // ARRANGE output.WriteLine("Starting timed test..."); var dt = new DisposeTester(output); // ACT output.WriteLine("Adding to safe disposer..."); DelayedDisposer.SafelyDispose(dt); // ASSERT output.WriteLine("Checking negative..."); dt.CheckNegative(); output.WriteLine("Waiting for disposal..."); await dt.WaitForDisposal(); output.WriteLine("Checking positive..."); dt.Check(); output.WriteLine("All done. Test should not hang anymore."); }