Skip to content

Commit

Permalink
fix the test
Browse files Browse the repository at this point in the history
  • Loading branch information
nkolev92 committed Oct 9, 2023
1 parent e73f43a commit 37ec8c7
Showing 1 changed file with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3196,14 +3196,12 @@ public async Task ExecuteAsync_WithConditionalProjectAndPackageReferences()
// Arrange
using var context = new SourceCacheContext();
using var pathContext = new SimpleTestPathContext();
// Add nuget.org for the extra package.
pathContext.Settings.AddSource("nuget.org", "https://api.nuget.org/v3/index.json");

var mainProject = "main";
var mainProjectPath = Path.Combine(pathContext.SolutionRoot, mainProject);

var childProject = "System.Numerics.Vectors";
var childProjectPath = Path.Combine(pathContext.SolutionRoot, childProject);
var systemNumericsVectorName = "System.Numerics.Vectors";
var childProjectPath = Path.Combine(pathContext.SolutionRoot, systemNumericsVectorName);

var mainProjectJson = @"
{
Expand All @@ -3229,7 +3227,7 @@ public async Task ExecuteAsync_WithConditionalProjectAndPackageReferences()
}
}
}";
PackageSpec systemNumericsVectorPackageSpec = ProjectTestHelpers.GetPackageSpec(childProject, pathContext.SolutionRoot, "net8.0");
PackageSpec systemNumericsVectorPackageSpec = ProjectTestHelpers.GetPackageSpec(systemNumericsVectorName, pathContext.SolutionRoot, "net8.0");
PackageSpec mainPackageSpec = ProjectTestHelpers.GetPackageSpecWithProjectNameAndSpec(mainProject, pathContext.SolutionRoot, mainProjectJson);
var settings = Settings.LoadDefaultSettings(pathContext.SolutionRoot);
mainPackageSpec.RestoreMetadata.ConfigFilePaths = settings.GetConfigFilePaths();
Expand All @@ -3244,6 +3242,18 @@ public async Task ExecuteAsync_WithConditionalProjectAndPackageReferences()
ProjectPath = systemNumericsVectorPackageSpec.RestoreMetadata.ProjectPath,
});

// create packages
var ns203 = new SimpleTestPackageContext("NETStandard.Library", "2.0.3");
var systemMemory = new SimpleTestPackageContext("System.Memory", "4.5.5");
var systemNumericsVector = new SimpleTestPackageContext(systemNumericsVectorName, "4.4.0");
systemMemory.Dependencies.Add(systemNumericsVector);

await SimpleTestPackageUtility.CreateFolderFeedV3Async(pathContext.PackageSource,
ns203,
systemMemory,
systemNumericsVector);


var logger = new TestLogger();
var request = ProjectTestHelpers.CreateRestoreRequest(pathContext, logger, mainPackageSpec, systemNumericsVectorPackageSpec);

Expand All @@ -3255,10 +3265,10 @@ public async Task ExecuteAsync_WithConditionalProjectAndPackageReferences()
var net80Target = result.LockFile.Targets.Single(e => e.TargetFramework.Equals(NuGetFramework.Parse("net8.0")));
var netstandard20 = result.LockFile.Targets.Single(e => e.TargetFramework.Equals(NuGetFramework.Parse("netstandard2.0")));
net80Target.Libraries.Should().HaveCount(1);
var net80Vectors = net80Target.Libraries.Single(e => e.Name.Equals("System.Numerics.Vectors"));
var net80Vectors = net80Target.Libraries.Single(e => e.Name.Equals(systemNumericsVectorName));
net80Vectors.Version.Should().Be(new NuGetVersion(1, 0, 0));
netstandard20.Libraries.Should().HaveCount(6);
var ns20Target = netstandard20.Libraries.Single(e => e.Name.Equals("System.Numerics.Vectors"));
netstandard20.Libraries.Should().HaveCount(3);
var ns20Target = netstandard20.Libraries.Single(e => e.Name.Equals(systemNumericsVectorName));
ns20Target.Version.Should().Be(new NuGetVersion(4, 4, 0));
}

Expand Down

0 comments on commit 37ec8c7

Please sign in to comment.