-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from Ellerbach/doclinkchecker-upgrade
Doclinkchecker upgrade
- Loading branch information
Showing
44 changed files
with
3,254 additions
and
657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
20
src/DocLinkChecker/DocLinkChecker.Test/DocLinkChecker.Test.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
106
src/DocLinkChecker/DocLinkChecker.Test/Helpers/MarkdownExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
Oops, something went wrong.