From 2390066bebcb94dddb141ba16e5e839620664138 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Fri, 31 Jan 2025 17:27:19 -0300 Subject: [PATCH] Use source sample files in tests Rather than copy-local unnecessary. --- src/Tests/Misc.cs | 18 +++++++++--------- src/Tests/Tests.csproj | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Tests/Misc.cs b/src/Tests/Misc.cs index 2e0ba50..dd38cb8 100644 --- a/src/Tests/Misc.cs +++ b/src/Tests/Misc.cs @@ -11,12 +11,12 @@ namespace Clarius.OpenLaw; public partial class Misc { [Theory] - [InlineData(@"SaijSamples\123456789-0abc-defg-g23-85000scanyel.json")] - [InlineData(@"SaijSamples\123456789-0abc-defg-g81-87000tcanyel.json")] - [InlineData(@"SaijSamples\123456789-0abc-defg-g56-95000scanyel.json")] + [InlineData("SaijSamples/123456789-0abc-defg-g23-85000scanyel.json")] + [InlineData("SaijSamples/123456789-0abc-defg-g81-87000tcanyel.json")] + [InlineData("SaijSamples/123456789-0abc-defg-g56-95000scanyel.json")] public void ConvertJsonToYaml(string jsonFile) { - var json = File.ReadAllText(jsonFile).ReplaceLineEndings(); + var json = File.ReadAllText(Path.Combine(ThisAssembly.Project.MSBuildProjectDirectory, jsonFile)).ReplaceLineEndings(); var dictionary = DictionaryConverter.Parse(json); Assert.NotNull(dictionary); @@ -25,15 +25,15 @@ public void ConvertJsonToYaml(string jsonFile) // Save the YAML to a file var yamlFile = Path.ChangeExtension(jsonFile, ".yaml"); - File.WriteAllText($@"..\..\..\{yamlFile}", yaml); + File.WriteAllText(yamlFile, yaml); } [Theory] - [InlineData(@"SaijSamples\123456789-0abc-defg-g23-85000scanyel.json")] - [InlineData(@"SaijSamples\123456789-0abc-defg-g56-95000scanyel.json")] + [InlineData("SaijSamples/123456789-0abc-defg-g23-85000scanyel.json")] + [InlineData("SaijSamples/123456789-0abc-defg-g56-95000scanyel.json")] public void ConvertJsonToMarkdown(string jsonFile) { - var json = File.ReadAllText(jsonFile).ReplaceLineEndings(); + var json = File.ReadAllText(Path.Combine(ThisAssembly.Project.MSBuildProjectDirectory, jsonFile)).ReplaceLineEndings(); var dictionary = DictionaryConverter.Parse(json); Assert.NotNull(dictionary); @@ -42,6 +42,6 @@ public void ConvertJsonToMarkdown(string jsonFile) // Save the Markdown to a file var markdownFile = Path.ChangeExtension(jsonFile, ".md"); - File.WriteAllText($@"..\..\..\{markdownFile}", markdown); + File.WriteAllText(markdownFile, markdown); } } diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index 81d6184..678e80d 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -10,6 +10,7 @@ + @@ -17,7 +18,7 @@ - +