Skip to content

Commit

Permalink
Merge pull request #32 from Ellerbach/doclinkchecker-upgrade
Browse files Browse the repository at this point in the history
Doclinkchecker upgrade
  • Loading branch information
mtirionMSFT authored Oct 9, 2023
2 parents b9c4c3a + 0d3ff1e commit 0865020
Show file tree
Hide file tree
Showing 44 changed files with 3,254 additions and 657 deletions.
16 changes: 8 additions & 8 deletions src/DocFxCompanionTools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,20 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33502.453
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocLinkChecker", ".\DocLinkChecker\DocLinkChecker.csproj", "{F9426B04-9122-4CB6-9441-53DBB8A3D594}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocLanguageTranslator", "DocLanguageTranslator\DocLanguageTranslator.csproj", "{2E546333-D995-48B0-AB00-50841A291288}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocLanguageTranslator", ".\DocLanguageTranslator\DocLanguageTranslator.csproj", "{2E546333-D995-48B0-AB00-50841A291288}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocFxTocGenerator", "DocFxTocGenerator\DocFxTocGenerator.csproj", "{AF24D716-5EFA-4DBB-99B1-3D50D8C1EA79}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocFxTocGenerator", ".\DocFxTocGenerator\DocFxTocGenerator.csproj", "{AF24D716-5EFA-4DBB-99B1-3D50D8C1EA79}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocFxOpenApi", "DocFxOpenApi\DocFxOpenApi.csproj", "{E14CC5CE-D478-44C4-9317-F8235BAA6336}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocFxOpenApi", ".\DocFxOpenApi\DocFxOpenApi.csproj", "{E14CC5CE-D478-44C4-9317-F8235BAA6336}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocLinkChecker", "DocLinkChecker\DocLinkChecker\DocLinkChecker.csproj", "{CF387302-315D-44F8-AE27-3B73894110AE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F9426B04-9122-4CB6-9441-53DBB8A3D594}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9426B04-9122-4CB6-9441-53DBB8A3D594}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9426B04-9122-4CB6-9441-53DBB8A3D594}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9426B04-9122-4CB6-9441-53DBB8A3D594}.Release|Any CPU.Build.0 = Release|Any CPU
{2E546333-D995-48B0-AB00-50841A291288}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E546333-D995-48B0-AB00-50841A291288}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E546333-D995-48B0-AB00-50841A291288}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -33,6 +29,10 @@ Global
{E14CC5CE-D478-44C4-9317-F8235BAA6336}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E14CC5CE-D478-44C4-9317-F8235BAA6336}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E14CC5CE-D478-44C4-9317-F8235BAA6336}.Release|Any CPU.Build.0 = Release|Any CPU
{CF387302-315D-44F8-AE27-3B73894110AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF387302-315D-44F8-AE27-3B73894110AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF387302-315D-44F8-AE27-3B73894110AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF387302-315D-44F8-AE27-3B73894110AE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 3 additions & 0 deletions src/DocLinkChecker/DocLinkChecker.Test/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Import Project="../../build/dotnet/tests.common.props" />
</Project>
20 changes: 20 additions & 0 deletions src/DocLinkChecker/DocLinkChecker.Test/DocLinkChecker.Test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\DocLinkChecker\DocLinkChecker.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Moq.Contrib.HttpClient" Version="1.4.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.5.0" />
</ItemGroup>

</Project>
106 changes: 106 additions & 0 deletions src/DocLinkChecker/DocLinkChecker.Test/Helpers/MarkdownExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
using Bogus;
using System;

namespace DocLinkChecker.Test.Helpers
{
internal static class MarkdownExtensions
{
internal static string AddHeading(this string s, string title, int level)
{
string content = $"{new string('#', level)} {title}" + Environment.NewLine + Environment.NewLine;
if (string.IsNullOrEmpty(s))
{
return content;
}
return s + Environment.NewLine + content;
}

internal static string AddParagraphs(this string s, int count = 1)
{
Faker faker = new Faker();
string content = (count == 1 ? faker.Lorem.Paragraph() : faker.Lorem.Paragraphs(count)) + Environment.NewLine;
if (string.IsNullOrEmpty(s))
{
return content;
}
return s + Environment.NewLine + content;
}

internal static string AddResourceLink(this string s, string url)
{
Faker faker = new Faker();
string content = $" ![some resource {faker.Random.Int(1)}]({url})" + Environment.NewLine;
if (string.IsNullOrEmpty(s))
{
return content;
}
return s + Environment.NewLine + content;
}

internal static string AddLink(this string s, string url)
{
Faker faker = new Faker();
string content = $" [some link {faker.Random.Int(1)}]({url})" + Environment.NewLine;
if (string.IsNullOrEmpty(s))
{
return content;
}
return s + Environment.NewLine + content;
}

internal static string AddTableStart(this string s, int columns = 3)
{
Faker faker = new Faker();
string content = "|";
for (int col = 0; col < columns; col++)
{
content += $" {faker.Lorem.Words(2)} |";
}
content += Environment.NewLine;
for (int col = 0; col < columns; col++)
{
content += $" --- |";
}
content += Environment.NewLine;
if (string.IsNullOrEmpty(s))
{
return content;
}
return s + Environment.NewLine + content;
}

internal static string AddTableRow(this string s, params string[] columns)
{
Faker faker = new Faker();
string content = "|";
foreach (string col in columns)
{
content += $" {col} |";
}
content += Environment.NewLine;
if (string.IsNullOrEmpty(s))
{
return content;
}
return s + Environment.NewLine + content;
}

internal static string AddNewLine(this string s)
{
if (string.IsNullOrEmpty(s))
{
return Environment.NewLine;
}
return s + Environment.NewLine;
}

internal static string AddRawMarkdown(this string s, string markdown)
{
if (string.IsNullOrEmpty(s))
{
return markdown;
}
return s + markdown;
}
}
}
Loading

0 comments on commit 0865020

Please sign in to comment.