Beispiel #1
0
        public JsonResult CreateAlias(string title, string userName)
        {
            if (string.IsNullOrEmpty(title))
            {
                title = "invalid value";
            }

            var page = new CmsPage();

            page.PageTitle = title;
            page.Alias     = CmsPage.CreateAlias(title);
            pageService.CreateEntry(page, userName);
            return(Json(new { alias = page.Alias, id = page.Id }));
        }
Beispiel #2
0
        public void Should_Replace_Space_with_Tilda()
        {
            string parsedTitle = CmsPage.CreateAlias("hello word");

            Assert.AreEqual("hello-word", parsedTitle);
        }
Beispiel #3
0
        public void Should_Remove_Words_Less_two_letters()
        {
            string parsedTitle = CmsPage.CreateAlias("hello 4kwn my And I can 4,2-y;% 334 you b43 34 word");

            Assert.AreEqual("hello-4kwn-and-can-334-you-b43-word", parsedTitle);
        }
Beispiel #4
0
        public void Should_Trim_string()
        {
            string parsedTitle = CmsPage.CreateAlias(" hello word ");

            Assert.AreEqual("hello-word", parsedTitle);
        }
Beispiel #5
0
        public void Should_Remove_all_Except_letters_and_Numbers()
        {
            string parsedTitle = CmsPage.CreateAlias("hello my !@#$%^&**(_{}[],. 4varite; won't 3234you 4u ");

            Assert.AreEqual("hello-4varite-won-3234you", parsedTitle);
        }
Beispiel #6
0
        public void Should_Make_lowercase()
        {
            string parsedTitle = CmsPage.CreateAlias("hELlo wOrd");

            Assert.AreEqual("hello-word", parsedTitle);
        }