'Get resource hex/ascii \n\r value not converted one
Greeting,
We have some translation stored in a resx file which contains a break line similar to:
"This is a Test
& or something similar. "

There are ~50 devs in our project and from time to time Visual studio corrects the translation into
"This is a Test
& or something similar. " causing our pipeline to fail (long story)

Now my goal is to write a test and to ensure that the translations are not "corrupted", but I found no way to get the actual hex or ASCII value of the string above. It always comes as \n\r .
I also want to mention that I would like not to change the current behavior of the app, only to get the proper ASCII or hex from the resource
This is what I would like to get from the resx file using: GetString or similar
&# xA;&# xD;
&# 13;&# 10;
[TestMethod] public void Test() { // Arrange var x = ToLiteral("This is a Test && or something similar."); // Act var xExpected = ToLiteral(Resources.Something.Some_Title); // Assert x.ShouldBe(xExpected ); } private static string ToLiteral(string valueTextForCompiler) { return Microsoft.CodeAnalysis.CSharp.SymbolDisplay.FormatLiteral(valueTextForCompiler, false); }
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
