コード例 #1
0
        public async Task ThrowsWhenStatusCodeIsSetAfterResponseStarted()
        {
            // Act
            await _http1Connection.WriteAsync(new ArraySegment <byte>(new byte[1]));

            // Assert
            Assert.True(_http1Connection.HasResponseStarted);
            Assert.Throws <InvalidOperationException>(() => ((IHttpResponseFeature)_http1Connection).StatusCode = StatusCodes.Status404NotFound);
        }