-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Blazot provider improvements. (#201)
- Loading branch information
1 parent
4a8bd8a
commit c82d035
Showing
7 changed files
with
69 additions
and
11 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
17 changes: 17 additions & 0 deletions
17
src/TagzApp.UnitTest/Blazot/Formatters/LinkFormattersTests.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,17 @@ | ||
using TagzApp.UnitTest.Blazot.TestData; | ||
|
||
namespace TagzApp.UnitTest.Blazot.Formatters; | ||
|
||
public class LinkFormattersTests | ||
{ | ||
[Theory] | ||
[ClassData(typeof(HashTagLinkData))] | ||
private void AddHashTagLinks_FormatsProperly_Test(string encodedText, string expectedText) | ||
{ | ||
// Act | ||
var response = TagzApp.Providers.Blazot.Formatters.LinkFormatters.AddHashTagLinks(encodedText); | ||
|
||
// Assert | ||
Assert.Equal(expectedText, response); | ||
} | ||
} |
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,30 @@ | ||
using System.Collections; | ||
using System.Web; | ||
|
||
namespace TagzApp.UnitTest.Blazot.TestData; | ||
|
||
public class HashTagLinkData : IEnumerable<object[]> | ||
{ | ||
private static readonly string _SimplePunctuationString = "I'm a test message"; | ||
private static readonly string _HashTagTouching = "I'm a test message <br/>#dotnet"; | ||
private static readonly string _TypicalString = "I'm a test message #dotnet"; | ||
private static readonly string _EmoticonString = "I'm a test message 😊 #dotnet"; | ||
|
||
private readonly List<object[]> _BodyText = new() | ||
{ | ||
new object[] {HttpUtility.HtmlEncode(_SimplePunctuationString), "I'm a test message"}, | ||
new object[] {HttpUtility.HtmlEncode(_HashTagTouching), "I'm a test message <br/><a class=\"b-hashtag-link\" target=\"_blank\" href=\"https://blazot.com/hashtag/dotnet\">#dotnet</a>" }, | ||
new object[] {HttpUtility.HtmlEncode(_TypicalString), "I'm a test message <a class=\"b-hashtag-link\" target=\"_blank\" href=\"https://blazot.com/hashtag/dotnet\">#dotnet</a>" }, | ||
new object[] {HttpUtility.HtmlEncode(_EmoticonString), "I'm a test message 😊 <a class=\"b-hashtag-link\" target=\"_blank\" href=\"https://blazot.com/hashtag/dotnet\">#dotnet</a>" } | ||
}; | ||
|
||
public IEnumerator<object[]> GetEnumerator() | ||
{ | ||
return _BodyText.GetEnumerator(); | ||
} | ||
|
||
IEnumerator IEnumerable.GetEnumerator() | ||
{ | ||
return GetEnumerator(); | ||
} | ||
} |
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