public static async Task StreamDisposed_ExpectObjectDisposedExceptionAsync() { var httpRequestStreamReader = new ProtoRequestStreamReader(new MemoryStream(), Encoding.UTF8, 10, ArrayPool <byte> .Shared, ArrayPool <char> .Shared); httpRequestStreamReader.Dispose(); await Assert.ThrowsAsync <ObjectDisposedException>(() => { return(httpRequestStreamReader.ReadAsync(new char[10], 0, 1)); }); }
public static void StreamDisposed_ExpectedObjectDisposedException(Action <ProtoRequestStreamReader> action) { var httpRequestStreamReader = new ProtoRequestStreamReader(new MemoryStream(), Encoding.UTF8, 10, ArrayPool <byte> .Shared, ArrayPool <char> .Shared); httpRequestStreamReader.Dispose(); Assert.Throws <ObjectDisposedException>(() => { action(httpRequestStreamReader); }); }