From aa629385b674c8bc060e3e6fe1c492b9df7173cb Mon Sep 17 00:00:00 2001 From: "p.vostretsov" Date: Wed, 30 Jan 2019 11:51:13 +0500 Subject: [PATCH] Fix line endings in tests --- TypeScript.ContractGenerator.Tests/EndToEndTests.cs | 4 ++-- TypeScript.ContractGenerator.Tests/FlowTypeTestBase.cs | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/TypeScript.ContractGenerator.Tests/EndToEndTests.cs b/TypeScript.ContractGenerator.Tests/EndToEndTests.cs index e963814..4ff331d 100644 --- a/TypeScript.ContractGenerator.Tests/EndToEndTests.cs +++ b/TypeScript.ContractGenerator.Tests/EndToEndTests.cs @@ -30,7 +30,7 @@ public EndToEndTests(JavaScriptTypeChecker javaScriptTypeChecker) [TestCase(typeof(NotNullRootType), "notnull-types.expected")] public void GenerateCodeTest(Type rootType, string expectedFileName) { - var generatedCode = GenerateCode(rootType).Single(); + var generatedCode = GenerateCode(rootType).Single().Replace("\r\n", "\n"); var expectedCode = File.ReadAllText(GetFilePath($"SimpleGenerator/{expectedFileName}")).Replace("\r\n", "\n"); generatedCode.Should().Be(expectedCode); } @@ -49,7 +49,7 @@ public void GenerateFilesTest(Type type) [TestCase(typeof(ArrayRootType), "array-types.expected")] public void CustomGeneratorTest(Type rootType, string expectedFileName) { - var generatedCode = GenerateCode(new CustomTypeGenerator(), rootType).Single(); + var generatedCode = GenerateCode(new CustomTypeGenerator(), rootType).Single().Replace("\r\n", "\n"); var expectedCode = File.ReadAllText(GetFilePath($"CustomGenerator/{expectedFileName}")).Replace("\r\n", "\n"); generatedCode.Should().Be(expectedCode); } diff --git a/TypeScript.ContractGenerator.Tests/FlowTypeTestBase.cs b/TypeScript.ContractGenerator.Tests/FlowTypeTestBase.cs index 8936785..57a2f75 100644 --- a/TypeScript.ContractGenerator.Tests/FlowTypeTestBase.cs +++ b/TypeScript.ContractGenerator.Tests/FlowTypeTestBase.cs @@ -65,7 +65,11 @@ private static void CheckDirectoriesEquivalenceInner(string expectedDirectory, s actualFiles.Should().BeEquivalentTo(expectedFiles); foreach (var filename in expectedFiles) - File.ReadAllText($"{actualDirectory}/{filename}").Should().Be(File.ReadAllText($"{expectedDirectory}/{filename}")); + { + var expected = File.ReadAllText($"{expectedDirectory}/{filename}").Replace("\r\n", "\n"); + var actual = File.ReadAllText($"{actualDirectory}/{filename}").Replace("\r\n", "\n"); + actual.Should().Be(expected); + } var expectedDirectories = Directory.EnumerateDirectories(expectedDirectory).Select(Path.GetFileName).ToArray(); var actualDirectories = Directory.EnumerateDirectories(actualDirectory).Select(Path.GetFileName).ToArray();