public void DisposeAsync_ExceptionReturnedInTask() { Exception e = new FormatException(); var tw = new InvokeActionOnDisposeTextWriter() { DisposeAction = () => { throw e; } }; ValueTask vt = tw.DisposeAsync(); Assert.True(vt.IsFaulted); Assert.Same(e, vt.AsTask().Exception.InnerException); }
public void DisposeAsync_InvokesDisposeSynchronously() { bool disposeInvoked = false; var tw = new InvokeActionOnDisposeTextWriter() { DisposeAction = () => disposeInvoked = true }; Assert.False(disposeInvoked); Assert.True(tw.DisposeAsync().IsCompletedSuccessfully); Assert.True(disposeInvoked); }