public void LocalLink_should_correctly_parse_other_markdown_file_reference() { var linkInline = new LinkInline("../README.md#my-heading", "Title"); var localLink = new LocalLink(linkInline); Assert.IsTrue(localLink.Heading.HasValue); Assert.IsNotNull(localLink.FilePath); }
public void LocalLink_should_correctly_parse_in_file_reference() { var linkInline = new LinkInline("#other-heading-in-doc", "Title"); var localLink = new LocalLink(linkInline); Assert.IsTrue(localLink.Heading.HasValue); Assert.IsNull(localLink.FilePath); }
public void LocalLink_should_correctly_parse_other_file_reference() { var linkInline = new LinkInline("../README.md", "Title"); var localLink = new LocalLink(linkInline); Assert.IsFalse(localLink.Heading.HasValue); Assert.IsNotNull(localLink.FilePath); Assert.AreEqual(linkInline.Url, localLink.FilePath); }
public void SetupDocumentCorpus() { // Move to a temp directory tempDirectory = Path.Combine(Path.GetTempPath(), "linter-docs-tests"); Directory.CreateDirectory(tempDirectory); currentDirectory = Environment.CurrentDirectory; Environment.CurrentDirectory = tempDirectory; // Create a non-markdown file for testing purposes Directory.CreateDirectory("test"); var fs = File.Create("test/image.png"); fs.Close(); // Create other markdown file with a heading var otherMarkdownDocPath = Path.GetFullPath(Path.Combine(tempDirectory, "test/test.md")); var otherMarkdownDoc = new SimplifiedMarkdownDoc(); otherMarkdownDoc.Headings.Add(new Heading("#test-heading")); corpus.Add(otherMarkdownDocPath, otherMarkdownDoc); // Create markdown file that would have links to be used in testing. markdownDocToTestPath = Path.GetFullPath(Path.Combine(tempDirectory, "links.md")); markdownDocToTest = new SimplifiedMarkdownDoc(); markdownDocToTest.Headings.Add(new Heading("#local-heading")); corpus.Add(markdownDocToTestPath, markdownDocToTest); // Create same file links sameFileHeadingExistsLink = new LocalLink(new LinkInline("#local-heading", string.Empty)); sameFileHeadingDoesNotExistLink = new LocalLink(new LinkInline("#incorrect-local-heading", string.Empty)); // Create other file links (no heading) otherFileExistsLink = new LocalLink(new LinkInline("test/image.png", string.Empty)); otherFileDoesNotExistLink = new LocalLink(new LinkInline("test/no-image.png", string.Empty)); // Create other directory links. otherDirectoryExistsLink = new LocalLink(new LinkInline("test/", string.Empty)); otherDirectoryDoesNotExistLink = new LocalLink(new LinkInline("no-test/", string.Empty)); // Create other file links with heading otherFileHeadingExistsLink = new LocalLink(new LinkInline("test/test.md#test-heading", string.Empty)); otherFileHeadingDoesNotExistLink = new LocalLink(new LinkInline("test/test.md#no-heading", string.Empty)); }
private void on_GameSetupSingleStart_clicked(System.Object obj, EventArgs e) { LocalLink link = new LocalLink(); Game.GetInstance().gameLink = link; /* Start AI players */ ArrayList AINames = whoAreAIPlayers(true); foreach(string name in AINames) { Player p = Game.GetInstance().PlayerByName(name); Console.WriteLine("Starting AI for ["+name+"] ["+p+"]"); if (p != null) link.startAIPlayer(1, p); } Game.GetInstance().State.BeginGame(); }