Пример #1
0
        public void BodyStream_does_not_send_bytes_while_paused()
        {
            var called = false;

            Func<ArraySegment<byte>, bool> next = (data) =>
            {
                called = true;
                return false;
            };

            var bodyStream = new BodyStream(next, null, null, CancellationToken.None);
            bodyStream.Start(() => { }, null);

            bodyStream.Pause();

            var bytes = new ArraySegment<byte>(Encoding.UTF8.GetBytes("dada"));

            bodyStream.SendBytes(bytes, null, null);

            Assert.That(called, Is.False);
        }