diff --git a/src/System.ServiceModel.BuildTools/tests/OperationInvokerGeneratorTests.cs b/src/System.ServiceModel.BuildTools/tests/OperationInvokerGeneratorTests.cs index 346aac1537ad..9910e8e21d33 100644 --- a/src/System.ServiceModel.BuildTools/tests/OperationInvokerGeneratorTests.cs +++ b/src/System.ServiceModel.BuildTools/tests/OperationInvokerGeneratorTests.cs @@ -141,7 +141,7 @@ internal static void RegisterOperationInvokers() } #nullable restore -""", Encoding.UTF8, SourceHashAlgorithm.Sha256)), +""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)), }, }, }; @@ -273,7 +273,7 @@ internal static void RegisterOperationInvokers() } #nullable restore -""", Encoding.UTF8, SourceHashAlgorithm.Sha256)), +""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)), }, }, }; @@ -371,7 +371,7 @@ internal static void RegisterOperationInvokers() } #nullable restore -""", Encoding.UTF8, SourceHashAlgorithm.Sha256)), +""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)), }, }, }; @@ -463,7 +463,7 @@ internal static void RegisterOperationInvokers() } #nullable restore -""", Encoding.UTF8, SourceHashAlgorithm.Sha256)), +""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)), }, }, }; @@ -555,7 +555,7 @@ internal static void RegisterOperationInvokers() } #nullable restore -""", Encoding.UTF8, SourceHashAlgorithm.Sha256)), +""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)), }, }, }; @@ -647,7 +647,7 @@ internal static void RegisterOperationInvokers() } #nullable restore -""", Encoding.UTF8, SourceHashAlgorithm.Sha256)), +""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)), }, }, }; @@ -739,7 +739,7 @@ internal static void RegisterOperationInvokers() } #nullable restore -""", Encoding.UTF8, SourceHashAlgorithm.Sha256)), +""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)), }, }, }; @@ -831,7 +831,7 @@ internal static void RegisterOperationInvokers() } #nullable restore -""", Encoding.UTF8, SourceHashAlgorithm.Sha256)), +""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)), }, }, }; @@ -839,4 +839,17 @@ internal static void RegisterOperationInvokers() await test.RunAsync(); } } + + internal static class StringExtensions + { + public static string FixLineEndingsOnMacOSX(this string input) + { + if (Environment.OSVersion.Platform == PlatformID.MacOSX) + { + return input.Replace("\r\n", "\n"); + } + + return input; + } + } }