Fix environment issues with tests
This commit is contained in:
@@ -1162,13 +1162,4 @@ namespace Umbraco.Tests.CoreXml
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
static class StringCrLfExtensions
|
||||
{
|
||||
public static string Lf(this string s)
|
||||
{
|
||||
if (string.IsNullOrEmpty(s)) return s;
|
||||
return s.Replace("\r", ""); // remove Cr
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
<asp:Content ContentPlaceHolderID=""ContentPlaceHolderDefault"" runat=""server"">
|
||||
|
||||
</asp:Content>
|
||||
", template.Content);
|
||||
".CrLf(), template.Content);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -131,7 +131,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
Assert.That(_masterPageFileSystem.FileExists("test2.master"), Is.True);
|
||||
Assert.AreEqual(@"<%@ Master Language=""C#"" MasterPageFile=""~/masterpages/test.master"" AutoEventWireup=""true"" %>
|
||||
|
||||
", template2.Content);
|
||||
".CrLf(), template2.Content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
30
src/Umbraco.Tests/StringNewlineExtensions.cs
Normal file
30
src/Umbraco.Tests/StringNewlineExtensions.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
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 CR everywhere
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace Umbraco.Tests.Strings
|
||||
});
|
||||
|
||||
Assert.AreEqual(@"body {font-family:Arial;}/**umb_name:My new rule*/
|
||||
p{font-size:1em; color:blue;} /** umb_name: Test2 */ li {padding:0px;} table {margin:0;}", result);
|
||||
p{font-size:1em; color:blue;} /** umb_name: Test2 */ li {padding:0px;} table {margin:0;}".CrLf(), result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -40,7 +40,7 @@ p{font-size:1em; color:blue;} /** umb_name: Test2 */ li {padding:0px;} table {m
|
||||
Assert.AreEqual(@"body {font-family:Arial;}/** Umb_Name: Test1 */ p { font-size: 1em; } /** umb_name: Test2 */ li {padding:0px;} table {margin:0;}
|
||||
|
||||
/**umb_name:My new rule*/
|
||||
p{font-size:1em; color:blue;}", result);
|
||||
p{font-size:1em; color:blue;}".CrLf(), result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -95,7 +95,7 @@ font-size: 1em;
|
||||
//Assert.IsTrue(results.First().RuleId.Value.Value.ToString() == file.Id.Value.Value + "/" + name);
|
||||
Assert.AreEqual(name, results.First().Name);
|
||||
Assert.AreEqual(selector, results.First().Selector);
|
||||
Assert.AreEqual(styles, results.First().Styles);
|
||||
Assert.AreEqual(styles.CrLf(), results.First().Styles);
|
||||
}
|
||||
|
||||
// No Name: keyword
|
||||
|
||||
@@ -181,6 +181,7 @@
|
||||
<Compile Include="Persistence\Repositories\TaskTypeRepositoryTest.cs" />
|
||||
<Compile Include="Resolvers\ResolverBaseTest.cs" />
|
||||
<Compile Include="Routing\UrlRoutingTestBase.cs" />
|
||||
<Compile Include="StringNewlineExtensions.cs" />
|
||||
<Compile Include="Strings\StylesheetHelperTests.cs" />
|
||||
<Compile Include="Strings\StringValidationTests.cs" />
|
||||
<Compile Include="FrontEnd\UmbracoHelperTests.cs" />
|
||||
|
||||
Reference in New Issue
Block a user