public void Home_WithCategoryTypeAndBlogHavingSubfolder_RendersUrlToPostsListPage()
        {
            //arrange
            var routeData = new RouteData();

            routeData.Values.Add("subfolder", "sub");
            AdminUrlHelper helper = SetupUrlHelper("/", routeData);

            //act
            string url = helper.Home();

            //assert
            Assert.AreEqual("/sub/admin/default.aspx", url);
        }
Esempio n. 2
0
        public void FeedbackEdit_WithCategoryTypeAndBlogHavingSubfolder_RendersUrlToFeedbackListPage()
        {
            //arrange
            var routeData = new RouteData();

            routeData.Values.Add("subfolder", "sub");
            AdminUrlHelper helper = SetupUrlHelper("/", routeData);

            //act
            string url = helper.FeedbackEdit(123);

            //assert
            Assert.AreEqual("/sub/admin/feedback/edit.aspx?return-to-post=true&FeedbackID=123", url);
        }
        public void EditCategories_WithCategoryTypeAndBlogHavingSubfolder_RendersUrlToPostsListPage()
        {
            //arrange
            var routeData = new RouteData();

            routeData.Values.Add("subfolder", "sub");
            AdminUrlHelper helper = SetupUrlHelper("/", routeData);

            //act
            string url = helper.EditCategories(CategoryType.PostCollection);

            //assert
            Assert.AreEqual("/sub/admin/EditCategories.aspx?catType=PostCollection", url);
        }
Esempio n. 4
0
        public void FeedbackList_WithBlogHavingSubfolder_RendersUrlToFeedbackListPage()
        {
            //arrange
            var routeData = new RouteData();

            routeData.Values.Add("subfolder", "sub");
            AdminUrlHelper helper = SetupUrlHelper("/", routeData);

            //act
            string url = helper.FeedbackList();

            //assert
            Assert.AreEqual("/sub/admin/feedback/default.aspx", url);
        }
Esempio n. 5
0
        public void ExportUrl_WithEmbedFalseAndSubFolder_RendersUrlWithQueryStringParameter()
        {
            //arrange
            var routeData = new RouteData();

            routeData.Values.Add("subfolder", "sub");
            AdminUrlHelper helper = SetupUrlHelper("/", routeData);

            //act
            string url = helper.Export(false);

            //assert
            Assert.AreEqual("/sub/admin/export.ashx?embed=False", url);
        }
Esempio n. 6
0
        private static void CreateWelcomeComment(ObjectRepository repository, AdminUrlHelper adminUrlHelper, Entry entry)
        {
            string commentBody = ScriptHelper.UnpackEmbeddedScriptAsString("WelcomeComment.htm");
            string feedbackUrl = adminUrlHelper.FeedbackList();

            commentBody = string.Format(commentBody, feedbackUrl);
            var comment = new FeedbackItem(FeedbackType.Comment)
            {
                Title    = "re: Welcome to Subtext!",
                Entry    = entry,
                Author   = "Subtext",
                Approved = true,
                Body     = commentBody
            };

            repository.Create(comment);
        }
Esempio n. 7
0
        private static Entry CreateWelcomeBlogPost(ISubtextContext context, Blog blog, IEntryPublisher entryPublisher, AdminUrlHelper adminUrlHelper, IEntryIdentity article)
        {
            string body       = ScriptHelper.UnpackEmbeddedScriptAsString("WelcomePost.htm");
            string articleUrl = context.UrlHelper.EntryUrl(article);

            body = String.Format(body, articleUrl, adminUrlHelper.Home(), context.UrlHelper.HostAdminUrl("default.aspx"));

            var entry = new Entry(PostType.BlogPost)
            {
                Title                    = "Welcome to Subtext!",
                EntryName                = "welcome-to-subtext",
                BlogId                   = blog.Id,
                Author                   = blog.Author,
                Body                     = body,
                DateCreated              = DateTime.Now,
                DateModified             = DateTime.Now,
                DateSyndicated           = DateTime.Now,
                IsActive                 = true,
                IncludeInMainSyndication = true,
                DisplayOnHomePage        = true,
                AllowComments            = true
            };

            entryPublisher.Publish(entry);
            return(entry);
        }
Esempio n. 8
0
        private static Entry CreateWelcomeArticle(Blog blog, IEntryPublisher entryPublisher, AdminUrlHelper adminUrlHelper)
        {
            string body = ScriptHelper.UnpackEmbeddedScriptAsString("WelcomeArticle.htm");

            body = String.Format(body, adminUrlHelper.ArticlesList());

            var article = new Entry(PostType.Story)
            {
                EntryName    = "welcome-to-subtext-article",
                Title        = "Welcome to Subtext!",
                BlogId       = blog.Id,
                Author       = blog.Author,
                Body         = body,
                DateCreated  = DateTime.Now,
                DateModified = DateTime.Now,
                IsActive     = true,
            };

            entryPublisher.Publish(article);
            return(article);
        }