public void containspagelink_should_return_false_when_title_does_not_exist_in_creole()
        {
            // Arrange
            CreoleParser      parser  = new CreoleParser(_applicationSettings, _siteSettings);
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = "here is a nice [[the internal wiki page title|the link text]]";

            // Act
            bool hasLink = updater.ContainsPageLink(text, "page title");

            // Assert
            Assert.That(hasLink, Is.False);
        }
Exemple #2
0
        public void containspagelink_should_return_true_when_title_exists_in_markdown()
        {
            // Arrange
            MarkdigParser     parser  = new MarkdigParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = "here is a nice [the link text](the-internal-wiki-page-title)";

            // Act
            bool hasLink = updater.ContainsPageLink(text, "the internal wiki page title");

            // Assert
            Assert.True(hasLink);
        }
        public void ContainsPageLink_Should_Return_True_When_Title_Exists_In_Markdown()
        {
            // Arrange
            MarkdownParser    parser  = new MarkdownParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = "here is a nice [the link text](the-internal-wiki-page-title)";

            // Act
            bool hasLink = updater.ContainsPageLink(text, "the internal wiki page title");

            // Assert
            Assert.That(hasLink, Is.True);
        }
        public void containspagelink_should_return_false_when_title_has_no_dashes_in_markdown()
        {
            // Arrange
            MarkdownParser    parser  = new MarkdownParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = "here is a nice [the link text](Markdown enforces dashes for spaces in urls)";

            // Act
            bool hasLink = updater.ContainsPageLink(text, "Markdown enforces dashes for spaces in urls");

            // Assert
            Assert.That(hasLink, Is.False);
        }
        public void ContainsPageLink_Should_Return_False_When_Title_Has_No_Dashes_In_Markdown()
        {
            // Arrange
            MarkdownParser    parser  = new MarkdownParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = "here is a nice [the link text](Markdown enforces dashes for spaces in urls)";

            // Act
            bool hasLink = updater.ContainsPageLink(text, "Markdown enforces dashes for spaces in urls");

            // Assert
            Assert.That(hasLink, Is.False);
        }
        public void containspagelink_should_return_false_when_title_does_not_exist_in_markdown()
        {
            // Arrange
            MarkdownParser    parser  = new MarkdownParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = "here is a nice [the link text](the-internal-wiki-page-title)";

            // Act
            bool hasLink = updater.ContainsPageLink(text, "page title");

            // Assert
            Assert.That(hasLink, Is.False);
        }
        public void ContainsPageLink_Should_Return_False_When_Title_Does_Not_Exist_In_Creole()
        {
            // Arrange
            CreoleParser      parser  = new CreoleParser(_applicationSettings, _siteSettings);
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = "here is a nice [[the internal wiki page title|the link text]]";

            // Act
            bool hasLink = updater.ContainsPageLink(text, "page title");

            // Assert
            Assert.That(hasLink, Is.False);
        }
Exemple #8
0
        public void containspagelink_should_return_false_when_title_does_not_exist_in_creole()
        {
            // Arrange
            var parser = new MarkdigParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = "here is a nice [[the internal wiki page title|the link text]]";

            // Act
            bool hasLink = updater.ContainsPageLink(text, "page title");

            // Assert
            Assert.False(hasLink);
        }
Exemple #9
0
        public void replacepagelinks_should_rename_basic_markdown_title()
        {
            // Arrange
            MarkdigParser     parser  = new MarkdigParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text           = "here is a nice [the link text](the-internal-wiki-page-title)";
            string expectedMarkup = "here is a nice [the link text](buy-stuff-online)";

            // Act
            string actualMarkup = updater.ReplacePageLinks(text, "the internal wiki page title", "buy stuff online");

            // Assert
            expectedMarkup.ShouldBe(actualMarkup);
        }
        public void ReplacePageLinks_Should_Rename_Basic_Creole_Title()
        {
            // Arrange
            CreoleParser      parser  = new CreoleParser(_applicationSettings, _siteSettings);
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text           = "here is a nice [[the internal wiki page title|the link text]]";
            string expectedMarkup = "here is a nice [[buy stuff online|the link text]]";

            // Act
            string actualMarkup = updater.ReplacePageLinks(text, "the internal wiki page title", "buy stuff online");

            // Assert
            Assert.That(actualMarkup, Is.EqualTo(expectedMarkup), actualMarkup);
        }
Exemple #11
0
 public PageService(ApplicationSettings settings, IRepository repository, SearchService searchService,
                    PageHistoryService historyService, IUserContext context,
                    ListCache listCache, PageViewModelCache pageViewModelCache, SiteCache sitecache, IPluginFactory pluginFactory)
     : base(settings, repository)
 {
     _searchService      = searchService;
     _markupConverter    = new MarkupConverter(settings, repository, pluginFactory);
     _historyService     = historyService;
     _context            = context;
     _listCache          = listCache;
     _pageViewModelCache = pageViewModelCache;
     _siteCache          = sitecache;
     _pluginFactory      = pluginFactory;
     _markupLinkUpdater  = new MarkupLinkUpdater(_markupConverter.Parser);
 }
        public void ReplacePageLinks_Should_Rename_Basic_Markdown_Title()
        {
            // Arrange
            MarkdownParser    parser  = new MarkdownParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text           = "here is a nice [the link text](the-internal-wiki-page-title)";
            string expectedMarkup = "here is a nice [the link text](buy-stuff-online)";

            // Act
            string actualMarkup = updater.ReplacePageLinks(text, "the internal wiki page title", "buy stuff online");

            // Assert
            Assert.That(actualMarkup, Is.EqualTo(expectedMarkup), actualMarkup);
        }
Exemple #13
0
        public void replacepagelinks_should_not_rename_title_that_is_not_found_in_markdown()
        {
            // Arrange
            MarkdigParser     parser  = new MarkdigParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = @"*here* is a nice **[the link text](the-internal-wiki-page-title)** and
                            another one: *here is a nice [the link text](the-internal-wiki-page-title) and
							a different one: *here is a nice [the link text](different-title)"                            ;

            // Act
            string actualMarkup = updater.ReplacePageLinks(text, "page title", "buy stuff online");

            // Assert
            text.ShouldBe(actualMarkup);
        }
        public void ReplacePageLinks_Should_Not_Rename_Title_That_Is_Not_Found_In_Markdown()
        {
            // Arrange
            MarkdownParser    parser  = new MarkdownParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = @"*here* is a nice **[the link text](the-internal-wiki-page-title)** and 
                            another one: *here is a nice [the link text](the-internal-wiki-page-title) and 
							a different one: *here is a nice [the link text](different-title)"                            ;

            // Act
            string actualMarkup = updater.ReplacePageLinks(text, "page title", "buy stuff online");

            // Assert
            Assert.That(actualMarkup, Is.EqualTo(text), actualMarkup);
        }
        public void ReplacePageLinks_Should_Not_Rename_Title_That_Is_Not_Found_In_Creole()
        {
            // Arrange
            CreoleParser      parser  = new CreoleParser(_applicationSettings, _siteSettings);
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = @"here is a nice [[the internal wiki page title|the link text]] and 
                            another one: here is a nice [[the internal wiki page title|the link text]] and 
							a different one: here is a nice [[different title|the link text]]"                            ;

            // Act
            string actualMarkup = updater.ReplacePageLinks(text, "page title", "buy stuff online");

            // Assert
            Assert.That(actualMarkup, Is.EqualTo(text), actualMarkup);
        }
Exemple #16
0
        public void replacepagelinks_should_rename_title_inside_markdown_markup_block()
        {
            // Arrange
            var parser = new MarkdigParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = @"//here is a nice **[the link text](the-internal-wiki-page-title)** and//
                            another one: *here is a nice [the link text](the-internal-wiki-page-title) and
							*a different one: here is a nice [the link text](different-title)"                            ;

            string expectedMarkup = @"//here is a nice **[the link text](buy-stuff-online)** and//
                            another one: *here is a nice [the link text](buy-stuff-online) and
							*a different one: here is a nice [the link text](different-title)"                            ;

            // Act
            string actualMarkup = updater.ReplacePageLinks(text, "the internal wiki page title", "buy stuff online");

            // Assert
            expectedMarkup.ShouldBe(actualMarkup);
        }
        public void replacepagelinks_should_rename_multiple_creole_titles()
        {
            // Arrange
            CreoleParser      parser  = new CreoleParser(_applicationSettings, _siteSettings);
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = @"here is a nice [[the internal wiki page title|the link text]] and 
                            another one: here is a nice [[the internal wiki page title|the link text]] and 
							a different one: here is a nice [[different title|the link text]]"                            ;

            string expectedMarkup = @"here is a nice [[buy stuff online|the link text]] and 
                            another one: here is a nice [[buy stuff online|the link text]] and 
							a different one: here is a nice [[different title|the link text]]"                            ;

            // Act
            string actualMarkup = updater.ReplacePageLinks(text, "the internal wiki page title", "buy stuff online");

            // Assert
            Assert.That(actualMarkup, Is.EqualTo(expectedMarkup), actualMarkup);
        }
        public void replacepagelinks_should_rename_title_inside_markdown_block()
        {
            // Arrange
            MarkdownParser    parser  = new MarkdownParser();
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = @"here is a nice [the link text](the-internal-wiki-page-title) and 
                            another one: here is a nice [the link text](the-internal-wiki-page-title) and 
							a different one: here is a nice [the link text](different-title)"                            ;

            string expectedMarkup = @"here is a nice [the link text](buy-stuff-online) and 
                            another one: here is a nice [the link text](buy-stuff-online) and 
							a different one: here is a nice [the link text](different-title)"                            ;

            // Act
            string actualMarkup = updater.ReplacePageLinks(text, "the internal wiki page title", "buy stuff online");

            // Assert
            Assert.That(actualMarkup, Is.EqualTo(expectedMarkup), actualMarkup);
        }
        public void ReplacePageLinks_Should_Rename_Title_Inside_Creole_Markup_Block()
        {
            // Arrange
            CreoleParser      parser  = new CreoleParser(_applicationSettings, _siteSettings);
            MarkupLinkUpdater updater = new MarkupLinkUpdater(parser);

            string text = @"//here is a nice **[[the internal wiki page title|the link text]]** and// 
                            another one: *here is a nice [[the internal wiki page title|the link text]] and 
							*a different one: here is a nice [[different title|the link text]]"                            ;

            string expectedMarkup = @"//here is a nice **[[buy stuff online|the link text]]** and// 
                            another one: *here is a nice [[buy stuff online|the link text]] and 
							*a different one: here is a nice [[different title|the link text]]"                            ;

            // Act
            string actualMarkup = updater.ReplacePageLinks(text, "the internal wiki page title", "buy stuff online");

            // Assert
            Assert.That(actualMarkup, Is.EqualTo(expectedMarkup), actualMarkup);
        }