Netcore: migrate more unittests (#8939)
* Migrated unit tests * Migrated CoreThings tests Signed-off-by: Bjarke Berg <mail@bergmania.dk> * Migrated Property Editor unit tests Signed-off-by: Bjarke Berg <mail@bergmania.dk> * Migrated CoreXml tests Signed-off-by: Bjarke Berg <mail@bergmania.dk> * Moved more tests Signed-off-by: Bjarke Berg <mail@bergmania.dk> * revert some IsSZArray test code Signed-off-by: Bjarke Berg <mail@bergmania.dk> * Renamed bad named test Signed-off-by: Bjarke Berg <mail@bergmania.dk> * removed unnecessary file mentions in csproj file Signed-off-by: Bjarke Berg <mail@bergmania.dk> Co-authored-by: Elitsa Marinovska <elm@umbraco.dk>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
public static class StringNewLineExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Ensures Lf only everywhere.
|
||||
/// </summary>
|
||||
/// <param name="text">The text to filter.</param>
|
||||
/// <returns>The filtered text.</returns>
|
||||
public static string Lf(this string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text)) return text;
|
||||
text = text.Replace("\r", ""); // remove CR
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures CrLf everywhere.
|
||||
/// </summary>
|
||||
/// <param name="text">The text to filter.</param>
|
||||
/// <returns>The filtered text.</returns>
|
||||
public static string CrLf(this string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text)) return text;
|
||||
text = text.Replace("\r", ""); // remove CR
|
||||
text = text.Replace("\n", "\r\n"); // add CRLF everywhere
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces Cr/Lf by a single space.
|
||||
/// </summary>
|
||||
/// <param name="text">The text to filter.</param>
|
||||
/// <returns>The filtered text.</returns>
|
||||
public static string NoCrLf(this string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text)) return text;
|
||||
text = text.Replace("\r\n", " "); // remove CRLF
|
||||
text = text.Replace("\r", " "); // remove CR
|
||||
text = text.Replace("\n", " "); // remove LF
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user