Exemplo n.º 1
0
        public void Dispose_HasInnerContent_DisposesInnerContent()
        {
            // Arrange
            var testHttpContext = new TestHttpContent();
            var content         = new GrpcWebResponseContent(testHttpContext, GrpcWebMode.GrpcWeb, new TestHttpHeaders());

            // Act
            content.Dispose();

            // Assert
            Assert.IsTrue(testHttpContext.Disposed);
        }
        public void ContentLength_InnerMissingContentLength_Null()
        {
            // Arrange
            var testHttpContext = new TestHttpContent()
            {
                ContentLength = null
            };
            var content = new GrpcWebRequestContent(testHttpContext, GrpcWebMode.GrpcWebText);

            // Act
            var contentLength = content.Headers.ContentLength;

            // Assert
            Assert.AreEqual(null, contentLength);
        }
        public void ContentLength_InnerHasContentLength_GrpcWebText_UseValue()
        {
            // Arrange
            var testHttpContext = new TestHttpContent()
            {
                ContentLength = 10
            };
            var content = new GrpcWebRequestContent(testHttpContext, GrpcWebMode.GrpcWebText);

            // Act
            var contentLength = content.Headers.ContentLength;

            // Assert
            Assert.AreEqual(16, contentLength);
        }