From 6f408beb1666d4a9d3dbeb0fdbf44a8596966b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20R=C3=A4tzel?= Date: Fri, 14 Aug 2020 10:51:29 +0000 Subject: [PATCH] Fix automated test for Elm format service Do not test differences in line-breaks: Add normalization of line-breaks before applying expectations. --- .../PersistentProcess.Test/TestElmEditor.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/implement/PersistentProcess/PersistentProcess.Test/TestElmEditor.cs b/implement/PersistentProcess/PersistentProcess.Test/TestElmEditor.cs index 3082399b..f6fb09cf 100644 --- a/implement/PersistentProcess/PersistentProcess.Test/TestElmEditor.cs +++ b/implement/PersistentProcess/PersistentProcess.Test/TestElmEditor.cs @@ -11,6 +11,9 @@ namespace Kalmit.PersistentProcess.Test [TestClass] public class TestElmEditor { + static string NormalizeStringTestingElmFormat(string originalString) => + originalString?.Trim()?.Replace("\n\r", "\n")?.Replace("\r\n", "\n"); + [TestMethod] public void Elm_editor_backend_support_format_elm_module_text() { @@ -78,10 +81,10 @@ module Common exposing (..) "responseStructure.ErrorResponse should be null.\n" + responseStructure.ErrorResponse); Assert.AreEqual( - expectedElmModuleTextAfterFormatting?.Trim(), - responseStructure - ?.FormatElmModuleTextResponse?.FirstOrDefault() - ?.formattedText.Just?.FirstOrDefault()?.Trim(), + NormalizeStringTestingElmFormat(expectedElmModuleTextAfterFormatting), + NormalizeStringTestingElmFormat(responseStructure + ?.FormatElmModuleTextResponse?.FirstOrDefault() + ?.formattedText.Just?.FirstOrDefault()), "Response content"); } }