This repository has been archived by the owner on Apr 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved the slug that was chosen for a file
- Loading branch information
1 parent
b39a6d3
commit 3dc9f32
Showing
4 changed files
with
103 additions
and
23 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
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,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using DuckyDocs.CRef; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace DuckyDocs.SiteBuilder.Tests | ||
{ | ||
public static class SlugGenerationFacts | ||
{ | ||
|
||
[Fact] | ||
public static void overload_slugs_differ() { | ||
var cRefA = new CRefIdentifier("M:TestLibrary1.Class1.Inherits.VirtualInstanceMethod(System.Int32)"); | ||
var cRefB = new CRefIdentifier("M:TestLibrary1.Class1.Inherits.VirtualInstanceMethod(System.String)"); | ||
|
||
var slugA = StaticApiPageGenerator.CreateSlugName(cRefA); | ||
var slugB = StaticApiPageGenerator.CreateSlugName(cRefB); | ||
|
||
slugA.Should().NotBe(slugB); | ||
} | ||
|
||
[Fact] | ||
public static void append_target_type_as_suffix() { | ||
var cRef = new CRefIdentifier("F:Class1.FieldA"); | ||
|
||
var slug = StaticApiPageGenerator.CreateSlugName(cRef); | ||
|
||
slug.Should().Be("Class1.FieldA-F"); | ||
} | ||
|
||
[Fact] | ||
public static void remove_generic_name_parts() { | ||
var cRef = new CRefIdentifier("M:TestLibrary1.Generic1`2.AMix`1(``1,`0)"); | ||
|
||
var slug = StaticApiPageGenerator.CreateSlugName(cRef); | ||
|
||
slug.Should().StartWith("TestLibrary1.Generic1.AMix-"); | ||
} | ||
|
||
} | ||
} |