Beispiel #1
0
        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));
            });
        }
Beispiel #2
0
        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);
            });
        }