public HttpRequestMessageContextWrapper(
     string virtualPathRoot,
     HttpRequestMessage httpRequest
     )
 {
     _httpWrapper = new HttpRequestMessageWrapper(virtualPathRoot, httpRequest);
     _items       = new Hashtable();
 }
        public void ApplicationPath_DelegatesToHttpRequestMessage(string applicationPath)
        {
            // Arrange
            HttpRequestMessage        request = new HttpRequestMessage();
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper(applicationPath, request);

            // Act
            string actualApplicationPath = wrapper.ApplicationPath;

            // Assert
            Assert.Equal(applicationPath, actualApplicationPath);
        }
        public void IsLocal_Call_To_HttpRequestMessageExtension_Method()
        {
            // Arrange
            HttpRequestMessage request = new HttpRequestMessage();

            request.SetIsLocal(new Lazy <bool>(() => true));
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper("/", request);

            // Act
            bool isLocal = wrapper.IsLocal;

            // Assert
            Assert.True(isLocal);
        }
        public void RawUrl_DelegatesToHttpRequestMessage_DoesNotEncode()
        {
            // Arrange
            Uri requestUri             = new Uri("http://localhost/some /path?query=value");
            HttpRequestMessage request = new HttpRequestMessage {
                RequestUri = requestUri
            };
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper("/", request);

            // Act
            string actualRawUrl = wrapper.RawUrl;

            // Assert
            Assert.Equal("/some /path?query=value", actualRawUrl);
        }
        public void Path_DelegatesToHttpRequestMessage()
        {
            // Arrange
            Uri requestUri             = new Uri("http://localhost/some/path?query=value");
            HttpRequestMessage request = new HttpRequestMessage {
                RequestUri = requestUri
            };
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper("/", request);

            // Act
            string actualPath = wrapper.Path;

            // Assert
            Assert.Equal("/some/path", actualPath);
        }
        public void RequestType_DelegatesToHttpRequestMessage()
        {
            // Arrange
            HttpRequestMessage request = new HttpRequestMessage
            {
                Method = new HttpMethod("DELETE")
            };
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper("/", request);

            // Act
            string actualRequestType = wrapper.RequestType;

            // Assert
            Assert.Equal("DELETE", actualRequestType);
        }
        public void FilePath_DelegatesToHttpRequestMessage(string virtualPathRoot, string requestUri, string expectedPath)
        {
            // Arrange
            HttpRequestMessage request = new HttpRequestMessage
            {
                RequestUri = new Uri(requestUri),
            };
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper(virtualPathRoot, request);

            // Act
            string actualPath = wrapper.FilePath;

            // Assert
            Assert.Equal(expectedPath, actualPath);
        }
        public void QueryString_DelegatesToHttpRequestMessage(string requestUri)
        {
            // Arrange
            Uri reqUri = new Uri(requestUri);
            NameValueCollection expectedQueryString = reqUri.ParseQueryString();
            HttpRequestMessage  request             = new HttpRequestMessage {
                RequestUri = reqUri
            };
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper("/", request);

            // Act
            NameValueCollection actualQuery = wrapper.QueryString;

            // Assert
            Assert.Equal(expectedQueryString.ToString(), actualQuery.ToString());
        }
 public HttpRequestMessageContextWrapper(string virtualPathRoot, HttpRequestMessage httpRequest)
 {
     _httpWrapper = new HttpRequestMessageWrapper(virtualPathRoot, httpRequest);
 }
        public void ApplicationPath_DelegatesToHttpRequestMessage(string applicationPath)
        {
            // Arrange
            HttpRequestMessage request = new HttpRequestMessage();
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper(applicationPath, request);

            // Act
            string actualApplicationPath = wrapper.ApplicationPath;

            // Assert
            Assert.Equal(applicationPath, actualApplicationPath);
        }
        public void RawUrl_DelegatesToHttpRequestMessage()
        {
            // Arrange
            Uri requestUri = new Uri("http://localhost/some/path?query=value");
            HttpRequestMessage request = new HttpRequestMessage
            {
                RequestUri = requestUri
            };
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper("/", request);

            // Act
            string actualRawUrl = wrapper.RawUrl;

            // Assert
            Assert.Equal(requestUri.PathAndQuery, actualRawUrl);
        }
        public void QueryString_DelegatesToHttpRequestMessage(string requestUri)
        {
            // Arrange
            Uri reqUri = new Uri(requestUri);
            NameValueCollection expectedQueryString = reqUri.ParseQueryString();
            HttpRequestMessage request = new HttpRequestMessage
            {
                RequestUri = reqUri
            };
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper("/", request);

            // Act
            NameValueCollection actualQuery = wrapper.QueryString;

            // Assert
            Assert.Equal(expectedQueryString.ToString(), actualQuery.ToString());
        }
        public void Path_DelegatesToHttpRequestMessage()
        {
            // Arrange
            Uri requestUri = new Uri("http://localhost/some/path?query=value");
            HttpRequestMessage request = new HttpRequestMessage
            {
                RequestUri = requestUri
            };
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper("/", request);

            // Act
            string actualPath = wrapper.Path;

            // Assert
            Assert.Equal(requestUri.AbsolutePath, actualPath);
        }
        public void RequestType_DelegatesToHttpRequestMessage()
        {
            // Arrange
            HttpRequestMessage request = new HttpRequestMessage
            {
                Method = new HttpMethod("DELETE")
            };
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper("/", request);

            // Act
            string actualRequestType = wrapper.RequestType;

            // Assert
            Assert.Equal("DELETE", actualRequestType);
        }
        public void FilePath_DelegatesToHttpRequestMessage(string virtualPathRoot, string requestUri, string expectedPath)
        {
            // Arrange
            HttpRequestMessage request = new HttpRequestMessage
            {
                RequestUri = new Uri(requestUri),
            };
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper(virtualPathRoot, request);

            // Act
            string actualPath = wrapper.FilePath;

            // Assert
            Assert.Equal(expectedPath, actualPath);
        }
        public void IsLocal_Call_To_HttpRequestMessageExtension_Method()
        {
            // Arrange
            HttpRequestMessage request = new HttpRequestMessage();
            request.SetIsLocal(new Lazy<bool>(() => true));
            HttpRequestMessageWrapper wrapper = new HttpRequestMessageWrapper("/", request);

            // Act
            bool isLocal = wrapper.IsLocal;

            // Assert
            Assert.True(isLocal);
        }
 public HttpBatchContextWrapper(HttpContextBase httpContext, HttpRequestMessage httpRequest)
 {
     _httpContextBase = httpContext;
     _items = new Hashtable();
     _httpRequestWrapper = new HttpRequestMessageWrapper(httpContext.Request.ApplicationPath, httpRequest);
 }