Skip to content

A Swiss Army knife for developers.

Fixed some test on Unix system

Etienne Baudouxa708c9513ac7
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Converters/JsonYamlConverterCommandLineToolTests.cs b/src/app/tests/DevToys.UnitTests/Tools/Converters/JsonYamlConverterCommandLineToolTests.cs
index a86cee2c9..ae729d41f 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Converters/JsonYamlConverterCommandLineToolTests.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Converters/JsonYamlConverterCommandLineToolTests.cs
@@ -64,7 +64,7 @@ public sealed class JsonYamlConverterCommandLineToolTests : MefBasedTest
int result = await _tool.InvokeAsync(_loggerMock.Object, default);
result.Should().Be(0);
string consoleOutput = _consoleWriter.ToString().Trim();
- consoleOutput.Should().Be("foo: bar\r\nfizz:\r\n - wizz");
+ consoleOutput.Should().Be("foo: bar\r\nfizz:\r\n - wizz".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Convert json with valid json and four spaces indentation should output valid yaml")]
@@ -77,7 +77,7 @@ public sealed class JsonYamlConverterCommandLineToolTests : MefBasedTest
int result = await _tool.InvokeAsync(_loggerMock.Object, default);
result.Should().Be(0);
string consoleOutput = _consoleWriter.ToString().Trim();
- consoleOutput.Should().Be("foo: bar\r\nfizz:\r\n - wizz");
+ consoleOutput.Should().Be("foo: bar\r\nfizz:\r\n - wizz".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Convert json with unknown json file should output invalid json error")]
@@ -123,7 +123,7 @@ public sealed class JsonYamlConverterCommandLineToolTests : MefBasedTest
int result = await _tool.InvokeAsync(_loggerMock.Object, default);
result.Should().Be(0);
string outputContent = File.ReadAllText(_tool.OutputFile.FullName);
- outputContent.Should().Be("foo: bar\r\nfizz:\r\n - wizz\r\n");
+ outputContent.Should().Be("foo: bar\r\nfizz:\r\n - wizz\r\n".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Convert json with valid json file and four spaces should output valid yaml file")]
@@ -139,7 +139,7 @@ public sealed class JsonYamlConverterCommandLineToolTests : MefBasedTest
int result = await _tool.InvokeAsync(_loggerMock.Object, default);
result.Should().Be(0);
string outputContent = File.ReadAllText(_tool.OutputFile.FullName);
- outputContent.Should().Be("foo: bar\r\nfizz:\r\n - wizz\r\n");
+ outputContent.Should().Be("foo: bar\r\nfizz:\r\n - wizz\r\n".Replace("\r\n", Environment.NewLine));
}
#endregion
@@ -167,7 +167,7 @@ public sealed class JsonYamlConverterCommandLineToolTests : MefBasedTest
int result = await _tool.InvokeAsync(_loggerMock.Object, default);
result.Should().Be(0);
string consoleOutput = _consoleWriter.ToString().Trim();
- consoleOutput.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}");
+ consoleOutput.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Convert yaml with valid yaml and four spaces should output valid json with four spaces")]
@@ -180,7 +180,7 @@ public sealed class JsonYamlConverterCommandLineToolTests : MefBasedTest
int result = await _tool.InvokeAsync(_loggerMock.Object, default);
result.Should().Be(0);
string consoleOutput = _consoleWriter.ToString().Trim();
- consoleOutput.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}");
+ consoleOutput.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Convert yaml with invalid yaml file should output invalid yaml error")]
@@ -210,7 +210,7 @@ public sealed class JsonYamlConverterCommandLineToolTests : MefBasedTest
int result = await _tool.InvokeAsync(_loggerMock.Object, default);
result.Should().Be(0);
string outputContent = File.ReadAllText(_tool.OutputFile.FullName);
- outputContent.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}");
+ outputContent.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Convert yaml with valid yaml file and four spaces should output valid json file")]
@@ -226,7 +226,7 @@ public sealed class JsonYamlConverterCommandLineToolTests : MefBasedTest
int result = await _tool.InvokeAsync(_loggerMock.Object, default);
result.Should().Be(0);
string outputContent = File.ReadAllText(_tool.OutputFile.FullName);
- outputContent.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}");
+ outputContent.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}".Replace("\r\n", Environment.NewLine));
}
#endregion
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Converters/JsonYamlConverterGuiToolTests.cs b/src/app/tests/DevToys.UnitTests/Tools/Converters/JsonYamlConverterGuiToolTests.cs
index d465ddee6..83858b65a 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Converters/JsonYamlConverterGuiToolTests.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Converters/JsonYamlConverterGuiToolTests.cs
@@ -52,7 +52,7 @@ public class JsonYamlConverterGuiToolTests : MefBasedTest
{
_inputTextArea.Text(" { \"foo\": \"bar\" } ");
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("foo: bar\r\n");
+ _outputTextArea.Text.Should().Be("foo: bar\r\n".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Convert json with valid json and two spaces indentation should return valid yaml")]
@@ -64,7 +64,7 @@ public class JsonYamlConverterGuiToolTests : MefBasedTest
indentationOptions.Select(0); // Select TwoSpaces
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("foo: bar\r\nfizz:\r\n - wizz\r\n");
+ _outputTextArea.Text.Should().Be("foo: bar\r\nfizz:\r\n - wizz\r\n".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Convert json with valid json and four spaces indentation should return valid yaml")]
@@ -76,7 +76,7 @@ public class JsonYamlConverterGuiToolTests : MefBasedTest
indentationOptions.Select(1); // Select FourSpaces
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("foo: bar\r\nfizz:\r\n - wizz\r\n");
+ _outputTextArea.Text.Should().Be("foo: bar\r\nfizz:\r\n - wizz\r\n".Replace("\r\n", Environment.NewLine));
}
[Theory(DisplayName = "Convert yaml with invalid input should return yaml error")]
@@ -115,7 +115,7 @@ public class JsonYamlConverterGuiToolTests : MefBasedTest
_inputTextArea.Text("foo: bar\r\nfizz:\r\n - wizz\r\n\r\n");
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}");
+ _outputTextArea.Text.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Convert yaml with valid yaml and four spaces should return valid json with four spaces")]
@@ -129,6 +129,6 @@ public class JsonYamlConverterGuiToolTests : MefBasedTest
_inputTextArea.Text("foo: bar\r\nfizz:\r\n - wizz\r\n\r\n");
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}");
+ _outputTextArea.Text.Should().Be("{\r\n \"foo\": \"bar\",\r\n \"fizz\": [\r\n \"wizz\"\r\n ]\r\n}".Replace("\r\n", Environment.NewLine));
}
}
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Json/JsonFormatterCommandLineToolTests.cs b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Json/JsonFormatterCommandLineToolTests.cs
index e08f01736..e6991c910 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Json/JsonFormatterCommandLineToolTests.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Json/JsonFormatterCommandLineToolTests.cs
@@ -56,6 +56,7 @@ public sealed class JsonFormatterCommandLineToolTests : MefBasedTest
[InlineData(false, "{\r\n \"a\": \"asdf\",\r\n \"c\": 545,\r\n \"b\": 33,\r\n \"array\": [\r\n {\r\n \"a\": \"asdf\",\r\n \"c\": 545,\r\n \"b\": 33,\r\n \"array\": []\r\n }\r\n ]\r\n}")]
public async Task FormatJsonWithValidJsonAndTwoSpacesShouldOutputValidJson(bool sortProperties, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
_tool.SortProperties = sortProperties;
_tool.Input = "{\"a\": \"asdf\", \"c\" : 545, \"b\": 33, \"array\": [{\"a\": \"asdf\", \"c\" : 545, \"b\": 33, \"array\": []}]}";
@@ -70,6 +71,7 @@ public sealed class JsonFormatterCommandLineToolTests : MefBasedTest
[InlineData(false, "{\r\n \"a\": \"asdf\",\r\n \"c\": 545,\r\n \"b\": 33,\r\n \"array\": [\r\n {\r\n \"a\": \"asdf\",\r\n \"c\": 545,\r\n \"b\": 33,\r\n \"array\": []\r\n }\r\n ]\r\n}")]
public async Task FormatJsonWithValidJsonAndFourSpacesShouldOutputValidJson(bool sortProperties, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
_tool.IndentationMode = Indentation.FourSpaces;
_tool.SortProperties = sortProperties;
_tool.Input = "{\"a\": \"asdf\", \"c\" : 545, \"b\": 33, \"array\": [{\"a\": \"asdf\", \"c\" : 545, \"b\": 33, \"array\": []}]}";
@@ -85,6 +87,7 @@ public sealed class JsonFormatterCommandLineToolTests : MefBasedTest
[InlineData(false, "{\r\n\t\"a\": \"asdf\",\r\n\t\"c\": 545,\r\n\t\"b\": 33,\r\n\t\"array\": [\r\n\t\t{\r\n\t\t\t\"a\": \"asdf\",\r\n\t\t\t\"c\": 545,\r\n\t\t\t\"b\": 33,\r\n\t\t\t\"array\": []\r\n\t\t}\r\n\t]\r\n}")]
public async Task FormatJsonWithValidJsonAndOneTabShouldOutputValidJson(bool sortProperties, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
_tool.IndentationMode = Indentation.OneTab;
_tool.SortProperties = sortProperties;
_tool.Input = "{\"a\": \"asdf\", \"c\" : 545, \"b\": 33, \"array\": [{\"a\": \"asdf\", \"c\" : 545, \"b\": 33, \"array\": []}]}";
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Json/JsonFormatterGuiToolTests.cs b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Json/JsonFormatterGuiToolTests.cs
index be0ee03aa..30c0291dc 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Json/JsonFormatterGuiToolTests.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Json/JsonFormatterGuiToolTests.cs
@@ -56,7 +56,10 @@ public class JsonFormatterGuiToolTests : MefBasedTest
indentationOptions.Select(0); // Select TwoSpaces
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("{\r\n \"foo\": 123\r\n}");
+
+ string expectedResult = "{\r\n \"foo\": 123\r\n}";
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
+ _outputTextArea.Text.Should().Be(expectedResult);
}
[Fact(DisplayName = "Format json with valid json and four spaces indentation should return valid json")]
@@ -68,7 +71,9 @@ public class JsonFormatterGuiToolTests : MefBasedTest
indentationOptions.Select(1); // Select FourSpaces
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("{\r\n \"foo\": 123\r\n}");
+ string expectedResult = "{\r\n \"foo\": 123\r\n}";
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
+ _outputTextArea.Text.Should().Be(expectedResult);
}
[Fact(DisplayName = "Format json with valid json and one tab indentation should return valid json")]
@@ -80,7 +85,9 @@ public class JsonFormatterGuiToolTests : MefBasedTest
indentationOptions.Select(2); // Select OneTab
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("{\r\n\t\"foo\": 123\r\n}");
+ string expectedResult = "{\r\n\t\"foo\": 123\r\n}";
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
+ _outputTextArea.Text.Should().Be(expectedResult);
}
[Fact(DisplayName = "Format json with valid json and minified should return valid json")]
@@ -106,11 +113,15 @@ public class JsonFormatterGuiToolTests : MefBasedTest
newLineOnAttributesOptions.On();
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("{\r\n \"a\": \"asdf\",\r\n \"array\": [\r\n {\r\n \"a\": \"asdf\",\r\n \"array\": [],\r\n \"b\": 33,\r\n \"c\": 545\r\n }\r\n ],\r\n \"b\": 33,\r\n \"c\": 545\r\n}");
+ string expectedResult = "{\r\n \"a\": \"asdf\",\r\n \"array\": [\r\n {\r\n \"a\": \"asdf\",\r\n \"array\": [],\r\n \"b\": 33,\r\n \"c\": 545\r\n }\r\n ],\r\n \"b\": 33,\r\n \"c\": 545\r\n}";
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
+ _outputTextArea.Text.Should().Be(expectedResult);
newLineOnAttributesOptions.Off();
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("{\r\n \"a\": \"asdf\",\r\n \"c\": 545,\r\n \"b\": 33,\r\n \"array\": [\r\n {\r\n \"a\": \"asdf\",\r\n \"c\": 545,\r\n \"b\": 33,\r\n \"array\": []\r\n }\r\n ]\r\n}");
+ expectedResult = "{\r\n \"a\": \"asdf\",\r\n \"c\": 545,\r\n \"b\": 33,\r\n \"array\": [\r\n {\r\n \"a\": \"asdf\",\r\n \"c\": 545,\r\n \"b\": 33,\r\n \"array\": []\r\n }\r\n ]\r\n}";
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
+ _outputTextArea.Text.Should().Be(expectedResult);
}
}
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterCommandLineToolTests.cs b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterCommandLineToolTests.cs
index bb137af05..94078f0ae 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterCommandLineToolTests.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterCommandLineToolTests.cs
@@ -87,6 +87,7 @@ VALUES
[InlineData(SqlLanguage.Db2, "SELECT col1 FROM tbl ORDER BY col2 DESC FETCH FIRST 20 ROWS ONLY;", "SELECT\r\n\tcol1\r\nFROM\r\n\ttbl\r\nORDER BY\r\n\tcol2 DESC\r\nFETCH FIRST\r\n\t20 ROWS ONLY;")]
public async Task FormatSqlWithValidSqlAndTabShouldOutputValidSql(SqlLanguage language, string input, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
_tool.Input = input;
_tool.SqlLanguage = language;
_tool.IndentationMode = Indentation.OneTab;
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterGuiToolTests.cs b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterGuiToolTests.cs
index 9705fb4d4..126ce5ef7 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterGuiToolTests.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterGuiToolTests.cs
@@ -78,6 +78,6 @@ FETCH FIRST
indentationOptions.Select(2); // Select OneTab
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("SELECT\r\n\t*\r\nFETCH FIRST\r\n\t2 ROWS ONLY;");
+ _outputTextArea.Text.Should().Be("SELECT\r\n\t*\r\nFETCH FIRST\r\n\t2 ROWS ONLY;".Replace("\r\n", Environment.NewLine));
}
}
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterTestHelpers.cs b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterTestHelpers.cs
index 1714943bc..52bd185f2 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterTestHelpers.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Sql/SqlFormatterTestHelpers.cs
@@ -998,6 +998,6 @@ FROM
internal static void AssertFormat(Formatter formatter, string input, string expectedOutput)
{
string output = formatter.Format(input);
- output.Should().Be(expectedOutput);
+ output.Replace("\r\n", Environment.NewLine).Should().Be(expectedOutput.Replace("\r\n", Environment.NewLine));
}
}
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Xml/XmlFormatterCommandLineToolTests.cs b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Xml/XmlFormatterCommandLineToolTests.cs
index b0fb7ec3c..461353060 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Xml/XmlFormatterCommandLineToolTests.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Xml/XmlFormatterCommandLineToolTests.cs
@@ -56,6 +56,7 @@ public sealed class XmlFormatterCommandLineToolTests : MefBasedTest
[InlineData(false, "<root>\r\n <xml test=\"true\" />\r\n</root>")]
public async Task FormatXmlWithValidXmlAndTwoSpacesShouldOutputValidXml(bool newLineOnAttributes, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
_tool.NewLineOnAttributes = newLineOnAttributes;
_tool.Input = "<root><xml test=\"true\" /></root>";
@@ -70,6 +71,7 @@ public sealed class XmlFormatterCommandLineToolTests : MefBasedTest
[InlineData(false, "<root>\r\n <xml test=\"true\" />\r\n</root>")]
public async Task FormatXmlWithValidXmlAndFourSpacesShouldOutputValidXml(bool newLineOnAttributes, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
_tool.IndentationMode = Indentation.FourSpaces;
_tool.NewLineOnAttributes = newLineOnAttributes;
_tool.Input = "<root><xml test=\"true\" /></root>";
@@ -85,6 +87,7 @@ public sealed class XmlFormatterCommandLineToolTests : MefBasedTest
[InlineData(false, "<root>\r\n\t<xml test=\"true\" />\r\n</root>")]
public async Task FormatXmlWithValidXmlAndOneTabShouldOutputValidXml(bool newLineOnAttributes, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
_tool.IndentationMode = Indentation.OneTab;
_tool.NewLineOnAttributes = newLineOnAttributes;
_tool.Input = "<root><xml test=\"true\" /></root>";
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Xml/XmlFormatterGuiToolTests.cs b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Xml/XmlFormatterGuiToolTests.cs
index 9037911e6..29512e1f4 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Formatters/Xml/XmlFormatterGuiToolTests.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Formatters/Xml/XmlFormatterGuiToolTests.cs
@@ -56,7 +56,7 @@ public class XmlFormatterGuiToolTests : MefBasedTest
indentationOptions.Select(0); // Select TwoSpaces
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("<root>\r\n <xml />\r\n</root>");
+ _outputTextArea.Text.Should().Be("<root>\r\n <xml />\r\n</root>".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Format xml with valid xml and four spaces indentation should return valid xml")]
@@ -68,7 +68,7 @@ public class XmlFormatterGuiToolTests : MefBasedTest
indentationOptions.Select(1); // Select FourSpaces
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("<root>\r\n <xml />\r\n</root>");
+ _outputTextArea.Text.Should().Be("<root>\r\n <xml />\r\n</root>".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Format xml with valid xml and one tab indentation should return valid xml")]
@@ -80,7 +80,7 @@ public class XmlFormatterGuiToolTests : MefBasedTest
indentationOptions.Select(2); // Select OneTab
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("<root>\r\n\t<xml />\r\n</root>");
+ _outputTextArea.Text.Should().Be("<root>\r\n\t<xml />\r\n</root>".Replace("\r\n", Environment.NewLine));
}
[Fact(DisplayName = "Format xml with valid xml and minified should return valid xml")]
@@ -106,11 +106,11 @@ public class XmlFormatterGuiToolTests : MefBasedTest
newLineOnAttributesOptions.On();
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("<root>\r\n <xml\r\n test=\"true\" />\r\n</root>");
+ _outputTextArea.Text.Should().Be("<root>\r\n <xml\r\n test=\"true\" />\r\n</root>".Replace("\r\n", Environment.NewLine));
newLineOnAttributesOptions.Off();
await _tool.WorkTask;
- _outputTextArea.Text.Should().Be("<root>\r\n <xml test=\"true\" />\r\n</root>");
+ _outputTextArea.Text.Should().Be("<root>\r\n <xml test=\"true\" />\r\n</root>".Replace("\r\n", Environment.NewLine));
}
}
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Helpers/JsonHelperTests.cs b/src/app/tests/DevToys.UnitTests/Tools/Helpers/JsonHelperTests.cs
index be28cd061..348c40f6f 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Helpers/JsonHelperTests.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Helpers/JsonHelperTests.cs
@@ -32,6 +32,7 @@ public class JsonHelperTests
[InlineData(" { \"foo\": 123 } ", "{\r\n \"foo\": 123\r\n}")]
public async Task FormatTwoSpaces(string input, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> result = await JsonHelper.FormatAsync(input, Indentation.TwoSpaces, false, new MockILogger(), CancellationToken.None);
result.Data.Should().Be(expectedResult);
}
@@ -45,6 +46,7 @@ public class JsonHelperTests
[InlineData(" { \"foo\": 123 } ", "{\r\n \"foo\": 123\r\n}")]
public async Task FormatFourSpaces(string input, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> result = await JsonHelper.FormatAsync(input, Indentation.FourSpaces, false, new MockILogger(), CancellationToken.None);
result.Data.Should().Be(expectedResult);
}
@@ -58,6 +60,7 @@ public class JsonHelperTests
[InlineData(" { \"foo\": 123 } ", "{\r\n\t\"foo\": 123\r\n}")]
public async Task FormatOneTab(string input, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> result = await JsonHelper.FormatAsync(input, Indentation.OneTab, false, new MockILogger(), CancellationToken.None);
result.Data.Should().Be(expectedResult);
}
@@ -148,6 +151,7 @@ public class JsonHelperTests
[InlineData(" - key: value\r\n key2: 1", "[\r\n {\r\n \"key\": \"value\",\r\n \"key2\": 1\r\n }\r\n]")]
public void ConvertFromYamlWithTwoSpaces(string input, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> result = JsonHelper.ConvertFromYaml(
input,
Indentation.TwoSpaces,
@@ -161,6 +165,7 @@ public class JsonHelperTests
[InlineData(" - key: value\r\n key2: 1", "[\r\n {\r\n \"key\": \"value\",\r\n \"key2\": 1\r\n }\r\n]")]
public void ConvertFromYamlWithFourSpaces(string input, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> result = JsonHelper.ConvertFromYaml(
input,
Indentation.FourSpaces,
@@ -174,6 +179,7 @@ public class JsonHelperTests
[InlineData("{\"a\": \"asdf\", \"c\" : 545, \"b\": 33, \"array\": [{\"a\": \"asdf\", \"c\" : 545, \"b\": 42, \"array\": []}]}", "array.[0].b", "[\r\n 42\r\n]")]
public async Task JsonPathTests(string json, string jsonPath, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
(await JsonHelper.TestJsonPathAsync(json, jsonPath, new MockILogger(), CancellationToken.None))
.Data.Should().Be(expectedResult);
}
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Helpers/XmlHelperTests.cs b/src/app/tests/DevToys.UnitTests/Tools/Helpers/XmlHelperTests.cs
index b620bde0b..207b4aab5 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Helpers/XmlHelperTests.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Helpers/XmlHelperTests.cs
@@ -31,6 +31,7 @@ public class XmlHelperTests
[InlineData("<root><xml test=\"true\" /></root>", "<root>\r\n <xml\r\n test=\"true\" />\r\n</root>", true)]
public void FormatTwoSpaces(string input, string expectedResult, bool newLineOnAttributes = false)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> actual = XmlHelper.Format(input, Indentation.TwoSpaces, newLineOnAttributes, new MockILogger());
actual.Data.Should().Be(expectedResult);
}
@@ -45,6 +46,7 @@ public class XmlHelperTests
[InlineData("<root><xml test=\"true\" /></root>", "<root>\r\n <xml\r\n test=\"true\" />\r\n</root>", true)]
public void FormatFourSpaces(string input, string expectedResult, bool newLineOnAttributes = false)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> actual = XmlHelper.Format(input, Indentation.FourSpaces, newLineOnAttributes, new MockILogger());
actual.Data.Should().Be(expectedResult);
}
@@ -59,6 +61,7 @@ public class XmlHelperTests
[InlineData("<root><xml test=\"true\" /></root>", "<root>\r\n\t<xml\r\n\t\ttest=\"true\" />\r\n</root>", true)]
public void FormatOneTab(string input, string expectedResult, bool newLineOnAttributes = false)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> actual = XmlHelper.Format(input, Indentation.OneTab, newLineOnAttributes, new MockILogger());
actual.Data.Should().Be(expectedResult);
}
diff --git a/src/app/tests/DevToys.UnitTests/Tools/Helpers/YamlHelperTests.cs b/src/app/tests/DevToys.UnitTests/Tools/Helpers/YamlHelperTests.cs
index c6cbdde30..e30ff019f 100644
--- a/src/app/tests/DevToys.UnitTests/Tools/Helpers/YamlHelperTests.cs
+++ b/src/app/tests/DevToys.UnitTests/Tools/Helpers/YamlHelperTests.cs
@@ -75,6 +75,7 @@ public class YamlHelperTests
[InlineData("{\r\n \"key\": \"value\",\r\n \"key2\": 1\r\n }", "key: value\r\nkey2: 1\r\n")]
public void ConvertFromJsonWithTwoSpaces(string input, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> result = YamlHelper.ConvertFromJson(
input,
Indentation.TwoSpaces,
@@ -88,6 +89,7 @@ public class YamlHelperTests
[InlineData("{\r\n \"key\": \"value\",\r\n \"key2\": 1\r\n }", "key: value\r\nkey2: 1\r\n")]
public void ConvertFromJsonWithFourSpaces(string input, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> result = YamlHelper.ConvertFromJson(
input,
Indentation.FourSpaces,
@@ -101,6 +103,7 @@ public class YamlHelperTests
[InlineData("[\r\n {\r\n \"key\": \"value\",\r\n \"key2\": 1\r\n }\r\n]", "- key: value\r\n key2: 1\r\n")]
public void ConvertFromJsonWithJsonRootArrayWithTwoSpaces(string input, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> result = YamlHelper.ConvertFromJson(
input,
Indentation.TwoSpaces,
@@ -114,6 +117,7 @@ public class YamlHelperTests
[InlineData("[\r\n {\r\n \"key\": \"value\",\r\n \"key2\": 1\r\n }\r\n]", "- key: value\r\n key2: 1\r\n")]
public void ConvertFromJsonWithJsonRootArrayWithFourSpaces(string input, string expectedResult)
{
+ expectedResult = expectedResult.Replace("\r\n", Environment.NewLine);
ResultInfo<string> result = YamlHelper.ConvertFromJson(
input,
Indentation.FourSpaces,