public void StopAcceptingWritesCausesWriteToThrowObjectDisposedException()
        {
            var stream = new HttpResponseStream(Mock.Of <IHttpBodyControlFeature>(), Mock.Of <IHttpResponseControl>());

            stream.StartAcceptingWrites();
            stream.StopAcceptingWrites();
            Assert.Throws <ObjectDisposedException>(() => { stream.WriteAsync(new byte[1], 0, 1); });
        }
        public void StopAcceptingWritesCausesWriteToThrowObjectDisposedException()
        {
            var stream = new HttpResponseStream(Mock.Of <IHttpBodyControlFeature>(), Mock.Of <IHttpResponseControl>());

            stream.StartAcceptingWrites();
            stream.StopAcceptingWrites();
            var ex = Assert.Throws <ObjectDisposedException>(() => { stream.WriteAsync(new byte[1], 0, 1); });

            Assert.Contains(CoreStrings.WritingToResponseBodyAfterResponseCompleted, ex.Message);
        }
Exemplo n.º 3
0
 public void Stop()
 {
     _request.StopAcceptingReads();
     _emptyRequest.StopAcceptingReads();
     _response.StopAcceptingWrites();
 }