Skip to content

Commit f20a296

Browse files
committed
Tests: copy test resources to output directory
Copy the test resources to the output directory so that we can resolve the easily, instead of trying to resolve them from the source directory.
1 parent 8e129e5 commit f20a296

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
<Compile Remove="desktop\**" Condition=" '$(TargetFramework)' != 'net461' " />
2626
</ItemGroup>
2727

28+
<ItemGroup>
29+
<Content Include="Resources\**\*.*">
30+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
31+
</Content>
32+
</ItemGroup>
33+
2834
<Target Name="CopyTestAppExes" AfterTargets="ResolveProjectReferences">
2935
<ItemGroup>
3036
<_TestAppFile Include="@(TestAppExe->'%(RootDir)%(Directory)%(Filename).exe')" />

LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ private static void SetUpTestEnvironment()
6363

6464
if (resourcesPath == null)
6565
{
66-
string initialAssemblyParentFolder = Directory.GetParent(new Uri(typeof(BaseFixture).GetTypeInfo().Assembly.CodeBase).LocalPath).FullName;
67-
int pos = initialAssemblyParentFolder.IndexOf("LibGit2Sharp.Tests");
68-
resourcesPath = Path.Combine(initialAssemblyParentFolder.Substring(0, pos), "../LibGit2Sharp.Tests/Resources");
66+
resourcesPath = Path.Combine(Directory.GetParent(new Uri(typeof(BaseFixture).GetTypeInfo().Assembly.CodeBase).LocalPath).FullName, "Resources");
6967
}
7068

7169
ResourcesDirectory = new DirectoryInfo(resourcesPath);

0 commit comments

Comments
 (0)