Skip to content

Commit

Permalink
PR remarks: assert assets in targets section
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-krystianc committed Nov 30, 2022
1 parent 2c31b02 commit 2f09ddd
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions test/NuGet.Core.Tests/NuGet.Commands.Test/IncludeTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1775,11 +1775,6 @@ public async Task IncludeType_FlowsIntoCentralTransitiveDependencies(LibraryIncl
var project1Directory = new DirectoryInfo(Path.Combine(tmpPath.SolutionRoot, "Project1"));
var project2Directory = new DirectoryInfo(Path.Combine(tmpPath.SolutionRoot, "Project2"));
var project3Directory = new DirectoryInfo(Path.Combine(tmpPath.SolutionRoot, "Project3"));
var globalPackages = new DirectoryInfo(Path.Combine(tmpPath.WorkingDirectory, "globalPackages"));
var packageSource = new DirectoryInfo(Path.Combine(tmpPath.WorkingDirectory, "packageSource"));

globalPackages.Create();
packageSource.Create();

var project3Spec = PackageReferenceSpecBuilder.Create("Project3", project3Directory.FullName)
.WithTargetFrameworks(new[]
Expand Down Expand Up @@ -1839,16 +1834,13 @@ public async Task IncludeType_FlowsIntoCentralTransitiveDependencies(LibraryIncl

var restoreContext = new RestoreArgs()
{
Sources = new List<string>() { packageSource.FullName },
GlobalPackagesFolder = globalPackages.FullName,
Sources = new List<string>() { tmpPath.PackageSource },
GlobalPackagesFolder = tmpPath.UserPackagesFolder,
Log = logger,
CacheContext = new TestSourceCacheContext(),
};

await SimpleTestPackageUtility.CreatePackagesAsync(
packageSource.FullName,
packageA);

await SimpleTestPackageUtility.CreatePackagesAsync(tmpPath.PackageSource, packageA);
var request = await ProjectTestHelpers.GetRequestAsync(restoreContext, project1Spec, project2Spec, project3Spec);

// Act
Expand All @@ -1859,6 +1851,10 @@ await SimpleTestPackageUtility.CreatePackagesAsync(
// Assert
Assert.True(result1.Success);
Assert.Equal(includeFlags, lockFile1.CentralTransitiveDependencyGroups.Single().TransitiveDependencies.Single().IncludeType);

var targetLibrary = lockFile1.Targets.Single().Libraries.Single(x => x.Name == packageA.Id);
Assert.EndsWith((includeFlags & LibraryIncludeFlags.Compile) == LibraryIncludeFlags.Compile ? "a.dll" : "_._", targetLibrary.CompileTimeAssemblies.Single().Path);
Assert.EndsWith((includeFlags & LibraryIncludeFlags.Runtime) == LibraryIncludeFlags.Runtime ? "a.dll" : "_._", targetLibrary.RuntimeAssemblies.Single().Path);
}
}

Expand Down

0 comments on commit 2f09ddd

Please sign in to comment.