Example #1
0
        public void AbsoulteUrlWithScheme_NullRelativeUrl()
        {
            // setup
            _httpContextTestData.Url = "http://MySite.org";
            var request = DependencyResolver.Current.Get <MyHttpContext>().Context.Request;

            // test
            var result = Extensions.AbsoluteUrlWithScheme(request, "http", null);

            // sense
            Assert.Null(result);
        }
Example #2
0
        public void AbsoulteUrlWithScheme_HttpToHttps()
        {
            // setup
            _httpContextTestData.Url = "http://MySite.org";
            var request = DependencyResolver.Current.Get <MyHttpContext>().Context.Request;

            // test
            var result = Extensions.AbsoluteUrlWithScheme(request, "https", "relativeUrl");

            // sense
            var uri = new Uri(result);

            Assert.Equal("https", uri.Scheme);
        }
Example #3
0
        public void AbsoulteUrlWithScheme_SchemeChange(string schemeIn, string schemeOut)
        {
            // setup
            _httpContextTestData.Url = schemeIn + "://MySite.org";
            var request = DependencyResolver.Current.Get <MyHttpContext>().Context.Request;

            // test
            var result = Extensions.AbsoluteUrlWithScheme(request, schemeOut, "relativeUrl");

            // sense
            var uri = new Uri(result);

            Assert.Equal(schemeOut, uri.Scheme);
        }