public void NoContextToWrap()
        {
            var wrapper = new HttpContextWrapper(null);

            Assert.Null(wrapper.GetHttpMethod());
            Assert.Null(wrapper.GetUri());
            Assert.Null(wrapper.GetUserAgent());
        }
        public void HttpContextWrapper_NullHttpContext()
        {
            var wrapper = new HttpContextWrapper(null);

            Assert.Null(wrapper.GetHttpMethod());
            Assert.Null(wrapper.GetUri());
            Assert.Null(wrapper.GetUserAgent());
            Assert.Equal(0, wrapper.GetStatusCode());
        }
        public void HttpContextWrapper()
        {
            var uri      = "http://google.com/";
            var request  = new HttpRequest("filename.cs", uri, "");
            var response = new HttpResponse(new StreamWriter(new MemoryStream()));
            var context  = new HttpContext(request, response);

            var wrapper = new HttpContextWrapper(context);

            Assert.Equal("GET", wrapper.GetHttpMethod());
            Assert.Equal(uri, wrapper.GetUri());
            Assert.Null(wrapper.GetUserAgent());
        }
        public void HttpContextWrapper_Simple()
        {
            var context = new DefaultHttpContext();

            var request = context.Request;

            request.Host   = new HostString("google.com");
            request.Scheme = "http";

            var wrapper = new HttpContextWrapper(context);

            Assert.Equal("", wrapper.GetHttpMethod());
            Assert.Equal("http://google.com", wrapper.GetUri());
            Assert.Equal("", wrapper.GetUserAgent());
        }
        public void HttpContextWrapper()
        {
            var context = new DefaultHttpContext();

            var request = context.Request;

            request.Method = "POST";
            request.Host   = new HostString("google.com");
            request.Scheme = "http";
            request.Headers["User-Agent"] = "user-agent";

            var wrapper = new HttpContextWrapper(context);

            Assert.Equal("POST", wrapper.GetHttpMethod());
            Assert.Equal("http://google.com", wrapper.GetUri());
            Assert.Equal("user-agent", wrapper.GetUserAgent());
        }