public void ContainsPageLink_Should_Return_True_When_Title_Exists_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, "the internal wiki page title"); // Assert Assert.That(hasLink, Is.True); }
public void Setup() { _applicationSettings = new ApplicationSettings(); _siteSettings = new SiteSettings(); _parser = new CreoleParser(_applicationSettings, _siteSettings); }
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); }
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); }
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); }
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); }
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); }