Fixes unit tests

This commit is contained in:
Sebastiaan Janssen
2016-02-17 13:28:11 +01:00
parent 3b9db8a92f
commit a91669abc0
3 changed files with 15 additions and 3 deletions

View File

@@ -41,6 +41,16 @@ namespace Umbraco.Core
ToCSharpEscapeChars[escape[0]] = escape[1]; ToCSharpEscapeChars[escape[0]] = escape[1];
} }
/// <summary>
/// Removes new lines and tabs
/// </summary>
/// <param name="txt"></param>
/// <returns></returns>
internal static string StripWhitespace(this string txt)
{
return Regex.Replace(txt, @"\s", string.Empty);
}
internal static string StripFileExtension(this string fileName) internal static string StripFileExtension(this string fileName)
{ {
//filenames cannot contain line breaks //filenames cannot contain line breaks

View File

@@ -1,5 +1,6 @@
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Web.UI.JavaScript; using Umbraco.Web.UI.JavaScript;
namespace Umbraco.Tests.Web.AngularIntegration namespace Umbraco.Tests.Web.AngularIntegration
@@ -29,7 +30,7 @@ namespace Umbraco.Tests.Web.AngularIntegration
angular.bootstrap(document, ['umbraco']); angular.bootstrap(document, ['umbraco']);
}); });
});", result); });".StripWhitespace(), result.StripWhitespace());
} }
} }
} }

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using Umbraco.Web.UI.JavaScript; using Umbraco.Web.UI.JavaScript;
using Umbraco.Core;
namespace Umbraco.Tests.Web.AngularIntegration namespace Umbraco.Tests.Web.AngularIntegration
{ {
@@ -19,7 +20,7 @@ namespace Umbraco.Tests.Web.AngularIntegration
d.Add("test4", "Test 4"); d.Add("test4", "Test 4");
d.Add("test5", "Test 5"); d.Add("test5", "Test 5");
var output = ServerVariablesParser.Parse(d); var output = ServerVariablesParser.Parse(d).StripWhitespace();
Assert.IsTrue(output.Contains(@"Umbraco.Sys.ServerVariables = { Assert.IsTrue(output.Contains(@"Umbraco.Sys.ServerVariables = {
""test1"": ""Test 1"", ""test1"": ""Test 1"",
@@ -27,7 +28,7 @@ namespace Umbraco.Tests.Web.AngularIntegration
""test3"": ""Test 3"", ""test3"": ""Test 3"",
""test4"": ""Test 4"", ""test4"": ""Test 4"",
""test5"": ""Test 5"" ""test5"": ""Test 5""
} ;")); } ;".StripWhitespace()));
} }
} }
} }