Skip to content

Commit

Permalink
test version safe nuget loader
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidVollmers committed Jun 22, 2024
1 parent 0ca420d commit b6bd207
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Doki.sln
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Doki.TestAssembly", "tests\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Doki.Tests.Common", "tests\Doki.Tests.Common\Doki.Tests.Common.csproj", "{0FA0FF7A-6EDA-4CB1-8D81-2DFB1A4077CC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Doki.CommandLine.Tests", "tests\Doki.CommandLine.Tests\Doki.CommandLine.Tests.csproj", "{67B12AF1-2696-411F-ADFD-B5C32A43BA71}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -52,6 +54,7 @@ Global
{6CCD9EE6-B3FC-485F-9155-553165141B20} = {8C7B5305-B599-4F08-B28B-DD9F1715DD51}
{0293D689-DFDC-4A78-80D8-BFC11DB0A175} = {08041208-BE3D-4BE8-9AF7-806B73985275}
{0FA0FF7A-6EDA-4CB1-8D81-2DFB1A4077CC} = {8C7B5305-B599-4F08-B28B-DD9F1715DD51}
{67B12AF1-2696-411F-ADFD-B5C32A43BA71} = {8C7B5305-B599-4F08-B28B-DD9F1715DD51}
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6F31B87A-2BD3-4FB4-8C08-7E059A338D4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -110,5 +113,9 @@ Global
{0FA0FF7A-6EDA-4CB1-8D81-2DFB1A4077CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0FA0FF7A-6EDA-4CB1-8D81-2DFB1A4077CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0FA0FF7A-6EDA-4CB1-8D81-2DFB1A4077CC}.Release|Any CPU.Build.0 = Release|Any CPU
{67B12AF1-2696-411F-ADFD-B5C32A43BA71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{67B12AF1-2696-411F-ADFD-B5C32A43BA71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67B12AF1-2696-411F-ADFD-B5C32A43BA71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67B12AF1-2696-411F-ADFD-B5C32A43BA71}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
10 changes: 7 additions & 3 deletions src/Doki.CommandLine/Doki.CommandLine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@
<PackageOutputPath>..\..\nuget</PackageOutputPath>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="Doki.CommandLine.Tests"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/>
<PackageReference Include="NuGet.Resolver" Version="6.9.1" />
<PackageReference Include="NuGet.Resolver" Version="6.9.1"/>
<PackageReference Include="Spectre.Console" Version="0.48.0"/>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Doki.Output.Extensions\Doki.Output.Extensions.csproj" />
<ProjectReference Include="..\Doki.Output.Extensions\Doki.Output.Extensions.csproj"/>
<ProjectReference Include="..\Doki\Doki.csproj"/>
</ItemGroup>

Expand Down
30 changes: 30 additions & 0 deletions tests/Doki.CommandLine.Tests/Doki.CommandLine.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0"/>
<PackageReference Include="xunit" Version="2.4.2"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Doki.CommandLine\Doki.CommandLine.csproj" />
<ProjectReference Include="..\Doki.Tests.Common\Doki.Tests.Common.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions tests/Doki.CommandLine.Tests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global using Xunit;
27 changes: 27 additions & 0 deletions tests/Doki.CommandLine.Tests/NuGetTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Doki.CommandLine.NuGet;
using Doki.Tests.Common;
using Xunit.Abstractions;

namespace Doki.CommandLine.Tests;

public class NuGetTests(ITestOutputHelper testOutputHelper)
{
[Fact]
public async Task NuGetLoader_TestAsync()
{
const string packageId = "Doki.Output.Json";
var tmpDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

var logger = new TestOutputLogger(testOutputHelper);

using var loader = new NuGetLoader(logger);

await loader.LoadPackageAsync(packageId, tmpDirectory);

Assert.False(logger.HadError);

var dllPath = Path.Combine(tmpDirectory, $"{packageId}.1.0.0", "lib", "net8.0", $"{packageId}.dll");

Assert.True(File.Exists(dllPath));
}
}

0 comments on commit b6bd207

Please sign in to comment.