Skip to content

Commit

Permalink
Use source sample files in tests
Browse files Browse the repository at this point in the history
Rather than copy-local unnecessary.
  • Loading branch information
kzu committed Jan 31, 2025
1 parent eae5a37 commit 62566dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/Tests/Misc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +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)
{
jsonFile = Path.Combine(ThisAssembly.Project.MSBuildProjectDirectory, jsonFile);
var json = File.ReadAllText(jsonFile).ReplaceLineEndings();

var dictionary = DictionaryConverter.Parse(json);
Expand All @@ -25,14 +26,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)
{
jsonFile = Path.Combine(ThisAssembly.Project.MSBuildProjectDirectory, jsonFile);
var json = File.ReadAllText(jsonFile).ReplaceLineEndings();

var dictionary = DictionaryConverter.Parse(json);
Expand All @@ -42,6 +44,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);
}
}
3 changes: 2 additions & 1 deletion src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
<PackageReference Include="SharpYaml" Version="2.1.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1" />
<PackageReference Include="ThisAssembly.Project" Version="2.0.10" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\OpenLaw\OpenLaw.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="@(None)" CopyToOutputDirectory="PreserveNewest" />
<ProjectProperty Include="MSBuildProjectDirectory" />
</ItemGroup>

</Project>

0 comments on commit 62566dc

Please sign in to comment.