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.
We want the project file to be more intuitive, which we can achieve by including the outgoing trust name (in addition to the incoming trust name) and moving the project reference to the beginning. Add string helpers to hyphenate sentences and remove non-alphanumeric characters so that trust names can be formatted as they are in the updated design. Also, add missing string helper tests and DRY up some duplication between the download handler methods.
- Loading branch information
1 parent
951b062
commit 49aedef
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