This repository has been archived by the owner on Oct 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
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 #359 from DFE-Digital/update-file-name-format
Update the template file name
- Loading branch information
Showing
5 changed files
with
135 additions
and
18 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,63 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Xunit; | ||
|
||
namespace Helpers.Tests | ||
{ | ||
public class StringHelperTests | ||
{ | ||
public class ToHtmlName | ||
{ | ||
[Fact] | ||
public void ReplacesCharacters() | ||
{ | ||
const string text = "some]text[for.testing"; | ||
|
||
var result = text.ToHtmlName(); | ||
|
||
Assert.Equal("some_text_for_testing", result); | ||
} | ||
} | ||
|
||
public class ToTitleCase | ||
{ | ||
[Theory] | ||
[InlineData("A TITLE", "A Title")] | ||
[InlineData("a title", "A Title")] | ||
public void FormatsAsTitleCase(string input, string expectedOutput) | ||
{ | ||
var result = input.ToTitleCase(); | ||
|
||
Assert.Equal(expectedOutput, result); | ||
} | ||
} | ||
|
||
public class ToHyphenated | ||
{ | ||
[Theory] | ||
[InlineData("some text", "some-text")] | ||
[InlineData("some text", "some-text")] | ||
[InlineData("some\ttext", "some-text")] | ||
public void ReplacesWhiteSpaceWithHyphens(string input, string expectedOutput) | ||
{ | ||
var result = input.ToHyphenated(); | ||
|
||
Assert.Equal(expectedOutput, result); | ||
} | ||
} | ||
|
||
public class RemoveNonAlphanumericOrWhiteSpace | ||
{ | ||
[Fact] | ||
public void RemovesCharacters() | ||
{ | ||
const string text = "some text-with-punctuation_and'numbers99][()"; | ||
|
||
var result = text.RemoveNonAlphanumericOrWhiteSpace(); | ||
|
||
Assert.Equal("some text-with-punctuation_andnumbers99", result); | ||
} | ||
} | ||
} | ||
} |
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