Example #1
0
        public void TestWriteTimeout()
        {
            var pipe = new Pipe {
                InputStream = { WriteTimeout = 0 }
            };

            pipe.SetFixedLength();
            pipe.WriteText(new string('a', 2 * Constants.ByteBufferSize));
            var asyncWrite = pipe.InputStream.WriteAsync(new byte[1], 0, 1);

            asyncWrite.ContinueWith(_ => { }).Wait(TimeSpan.FromSeconds(.01)).ShouldEqual(true);
            asyncWrite.IsFaulted.ShouldEqual(true);
            UnitTestHelpers.AssertIsInstanceOf <TimeoutException>(asyncWrite.Exception.InnerException);
        }