public void ConfigureRequest_Returns_False_Without_HasPublishedContent()
        {
            var routeCtx = GetRoutingContext("/test");

            var pcre = new PublishedContentRequestEngine(
                Mock.Of <IWebRoutingSection>(),
                new PublishedContentRequest(
                    routeCtx.UmbracoContext.CleanedUmbracoUrl,
                    routeCtx,
                    Mock.Of <IWebRoutingSection>(),
                    s => new string[] { }));

            var result = pcre.ConfigureRequest();

            Assert.IsFalse(result);
        }
        public void ConfigureRequest_Sets_UmbracoPage_When_Published_Content_Assigned()
        {
            var routeCtx = GetRoutingContext("/test");

            var pcr = new PublishedContentRequest(routeCtx.UmbracoContext.CleanedUmbracoUrl, routeCtx, Mock.Of <IWebRoutingSection>(), s => new string[] { });
            var pc  = GetPublishedContentMock();

            pcr.Culture          = new CultureInfo("en-AU");
            pcr.PublishedContent = pc.Object;
            var pcre = new PublishedContentRequestEngine(
                Mock.Of <IWebRoutingSection>(),
                pcr);

            pcre.ConfigureRequest();

            Assert.IsNotNull(pcr.UmbracoPage);
        }
        public void ConfigureRequest_Adds_HttpContext_Items_When_Published_Content_Assigned()
        {
            var routeCtx = GetRoutingContext("/test");

            var pcr = new PublishedContentRequest(routeCtx.UmbracoContext.CleanedUmbracoUrl, routeCtx, Mock.Of <IWebRoutingSection>(), s => new string[] { });
            var pc  = GetPublishedContentMock();

            pcr.PublishedContent = pc.Object;
            pcr.Culture          = new CultureInfo("en-AU");
            var pcre = new PublishedContentRequestEngine(
                Mock.Of <IWebRoutingSection>(),
                pcr);

            pcre.ConfigureRequest();

            Assert.AreEqual(1, routeCtx.UmbracoContext.HttpContext.Items["pageID"]);
            Assert.AreEqual(pcr.UmbracoPage.Elements.Count, ((Hashtable)routeCtx.UmbracoContext.HttpContext.Items["pageElements"]).Count);
        }
        public void ConfigureRequest_Returns_False_When_IsRedirect()
        {
            var routeCtx = GetRoutingContext("/test");

            var pcr = new PublishedContentRequest(routeCtx.UmbracoContext.CleanedUmbracoUrl, routeCtx, Mock.Of <IWebRoutingSection>(), s => new string[] { });
            var pc  = GetPublishedContentMock();

            pcr.PublishedContent = pc.Object;
            pcr.Culture          = new CultureInfo("en-AU");
            pcr.SetRedirect("/hello");
            var pcre = new PublishedContentRequestEngine(
                Mock.Of <IWebRoutingSection>(),
                pcr);

            var result = pcre.ConfigureRequest();

            Assert.IsFalse(result);
        }