Skip to content

Commit 97e0c07

Browse files
committed
Additional tests
1 parent 9098d9b commit 97e0c07

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/Slugify.Core.Tests/SlugHelperTests.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,4 +784,28 @@ public void MaximumLengthGivenTrimsUnnecessaryChars(int? length, string input, s
784784
});
785785
Assert.Equal(expected, helper.GenerateSlug(input));
786786
}
787+
788+
[Fact]
789+
public void TestsInTheReadme()
790+
{
791+
const string original = "Simple,short&quick Example";
792+
const string expected = "Simple-short-quick-Example";
793+
794+
// Creating a configuration object
795+
var config = new SlugHelperConfiguration();
796+
797+
// Add individual replacement rules
798+
config.StringReplacements.Add("&", "-");
799+
config.StringReplacements.Add(",", "-");
800+
801+
// Keep the casing of the input string
802+
config.ForceLowerCase = false;
803+
804+
805+
var helper = Create(config);
806+
807+
808+
Assert.Equal(expected, helper.GenerateSlug(original));
809+
}
810+
787811
}

0 commit comments

Comments
 (0)