public async Task NominateProjectAsync_LockFileSettings(
            string restorePackagesWithLockFile,
            string lockFilePath,
            string restoreLockedMode)
        {
            var cps             = NewCpsProject("{ }");
            var projectFullPath = cps.ProjectFullPath;
            var pri             = cps.Builder
                                  .WithTargetFrameworkInfo(
                new VsTargetFrameworkInfo(
                    "netcoreapp1.0",
                    Enumerable.Empty <IVsReferenceItem>(),
                    Enumerable.Empty <IVsReferenceItem>(),
                    new[] {
                new VsProjectProperty("RestorePackagesWithLockFile", restorePackagesWithLockFile),
                new VsProjectProperty("NuGetLockFilePath", lockFilePath),
                new VsProjectProperty("RestoreLockedMode", restoreLockedMode)
            }))
                                  .Build();

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, cps.ProjectRestoreInfo);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);
            Assert.Equal(restorePackagesWithLockFile, actualProjectSpec.RestoreMetadata.RestoreLockProperties.RestorePackagesWithLockFile);
            Assert.Equal(lockFilePath, actualProjectSpec.RestoreMetadata.RestoreLockProperties.NuGetLockFilePath);
            Assert.Equal(MSBuildStringUtility.IsTrue(restoreLockedMode), actualProjectSpec.RestoreMetadata.RestoreLockProperties.RestoreLockedMode);
        }
Beispiel #2
0
        public async Task NominateProjectAsync_WithIdenticalPackageVersions(string version1, string version2)
        {
            var cps             = NewCpsProject("{ }");
            var projectFullPath = cps.ProjectFullPath;
            var pri             = cps.Builder
                                  .WithTargetFrameworkInfo(
                new VsTargetFrameworkInfo(
                    "netcoreapp1.0",
                    Enumerable.Empty <IVsReferenceItem>(),
                    Enumerable.Empty <IVsReferenceItem>(),
                    new[] { new VsProjectProperty("PackageVersion", version1) }))
                                  .WithTargetFrameworkInfo(
                new VsTargetFrameworkInfo(
                    "net46",
                    Enumerable.Empty <IVsReferenceItem>(),
                    Enumerable.Empty <IVsReferenceItem>(),
                    new[] { new VsProjectProperty("PackageVersion", version2) }))
                                  .Build();

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, cps.ProjectRestoreInfo);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);
            Assert.Equal(version1, actualProjectSpec.Version.ToString());
        }
        public async Task NominateProjectAsync_WithCliTool20_InfersToolFramework()
        {
            const string toolProjectJson = @"{
    ""frameworks"": {
        ""net46"": { },
        ""netcoreapp2.0"": { }
    }
}";
            var          cps             = NewCpsProject(toolProjectJson);
            var          pri             = cps.Builder.WithTool("Foo.Test.Tools", "2.0.0").Build();
            var          projectFullPath = cps.ProjectFullPath;

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, pri);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);

            var actualToolSpec = actualRestoreSpec
                                 .Projects
                                 .Where(p => !object.ReferenceEquals(p, actualProjectSpec))
                                 .Single();
            var actualToolFramework = actualToolSpec
                                      .TargetFrameworks
                                      .Single()
                                      .FrameworkName;

            Assert.Equal(CommonFrameworks.NetCoreApp20, actualToolFramework);
        }
        public void SpecValidationUtility_UAP_VerifyProjectJsonPath()
        {
            // Arrange
            var spec = new DependencyGraphSpec();

            spec.AddRestore("a");

            var targetFramework1 = new TargetFrameworkInformation()
            {
                FrameworkName = NuGetFramework.Parse("net45")
            };

            var info = new[] { targetFramework1 };

            var project = new PackageSpec(info);

            project.RestoreMetadata = new ProjectRestoreMetadata();
            project.Name            = "a";
            project.FilePath        = Path.Combine(Directory.GetCurrentDirectory(), "project.json");
            project.RestoreMetadata.ProjectUniqueName = "a";
            project.RestoreMetadata.ProjectName       = "a";
            project.RestoreMetadata.ProjectPath       = Path.Combine(Directory.GetCurrentDirectory(), "a.csproj");
            project.RestoreMetadata.ProjectJsonPath   = Path.Combine(Directory.GetCurrentDirectory(), "project.json");
            project.RestoreMetadata.OutputPath        = Directory.GetCurrentDirectory();
            project.RestoreMetadata.ProjectStyle      = ProjectStyle.ProjectJson;
            project.RestoreMetadata.OriginalTargetFrameworks.Add("net45");

            spec.AddProject(project);

            SpecValidationUtility.ValidateDependencySpec(spec);
        }
Beispiel #5
0
        public async Task NominateProjectAsync_Imports()
        {
            const string projectJson     = @"{
    ""frameworks"": {
        ""netstandard1.4"": {
            ""imports"": [""dotnet5.3"",""portable-net452+win81""]
        }
    }
}";
            var          cps             = NewCpsProject(projectJson);
            var          projectFullPath = cps.ProjectFullPath;

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, cps.ProjectRestoreInfo);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);

            var actualTfi     = actualProjectSpec.TargetFrameworks.Single();
            var actualImports = string.Join(";", actualTfi.Imports.Select(x => x.GetShortFolderName()));

            Assert.Equal("dotnet5.3;portable-net452+win81", actualImports);
        }
Beispiel #6
0
        public async Task NominateProjectAsync_CrossTargeting(
            string projectJson, string rawOriginalTargetFrameworks, string expectedOriginalTargetFrameworks)
        {
            var cps = NewCpsProject(
                projectJson: projectJson,
                crossTargeting: true);
            var projectFullPath = cps.ProjectFullPath;
            var pri             = cps.ProjectRestoreInfo;

            pri.OriginalTargetFrameworks = rawOriginalTargetFrameworks;

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, pri);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);

            var actualMetadata = actualProjectSpec.RestoreMetadata;

            Assert.NotNull(actualMetadata);
            Assert.True(actualMetadata.CrossTargeting);

            var actualOriginalTargetFrameworks = string.Join(";", actualMetadata.OriginalTargetFrameworks);

            Assert.Equal(
                expectedOriginalTargetFrameworks,
                actualOriginalTargetFrameworks);
        }
Beispiel #7
0
        public async Task NominateProjectAsync_ConsoleAppTemplate()
        {
            var consoleAppProjectJson = @"{
    ""frameworks"": {
        ""netcoreapp1.0"": {
            ""dependencies"": {
                ""Microsoft.NET.Sdk"": {
                    ""target"": ""Package"",
                    ""version"": ""1.0.0-alpha-20161019-1""
                },
                ""Microsoft.NETCore.App"": {
                    ""target"": ""Package"",
                    ""version"": ""1.0.1""
                }
            }
        }
    }
}";
            var projectName           = "ConsoleApp1";
            var cps             = NewCpsProject(consoleAppProjectJson, projectName);
            var pri             = cps.ProjectRestoreInfo;
            var projectFullPath = cps.ProjectFullPath;

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, pri);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);
            Assert.Equal("1.0.0", actualProjectSpec.Version.ToString());

            var actualMetadata = actualProjectSpec.RestoreMetadata;

            Assert.NotNull(actualMetadata);
            Assert.Equal(projectFullPath, actualMetadata.ProjectPath);
            Assert.Equal(projectName, actualMetadata.ProjectName);
            Assert.Equal(ProjectStyle.PackageReference, actualMetadata.ProjectStyle);
            Assert.Equal(pri.BaseIntermediatePath, actualMetadata.OutputPath);

            Assert.Single(actualProjectSpec.TargetFrameworks);
            var actualTfi = actualProjectSpec.TargetFrameworks.Single();

            var expectedFramework = NuGetFramework.Parse("netcoreapp1.0");

            Assert.Equal(expectedFramework, actualTfi.FrameworkName);

            AssertPackages(actualTfi,
                           "Microsoft.NET.Sdk:1.0.0-alpha-20161019-1",
                           "Microsoft.NETCore.App:1.0.1");
        }
Beispiel #8
0
        public async Task NominateProjectAsync_WithCliTool()
        {
            const string toolProjectJson = @"{
    ""frameworks"": {
        ""netcoreapp1.0"": { }
    }
}";
            var          cps             = NewCpsProject(toolProjectJson);
            var          pri             = cps.Builder.WithTool("Foo.Test.Tools", "2.0.0").Build();
            var          projectFullPath = cps.ProjectFullPath;

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, pri);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);

            var actualToolSpec = actualRestoreSpec
                                 .Projects
                                 .Where(p => !object.ReferenceEquals(p, actualProjectSpec))
                                 .Single();
            var actualMetadata = actualToolSpec.RestoreMetadata;

            Assert.NotNull(actualMetadata);
            Assert.Equal(projectFullPath, actualMetadata.ProjectPath);
            Assert.Equal(ProjectStyle.DotnetCliTool, actualMetadata.ProjectStyle);
            Assert.Null(actualMetadata.OutputPath);

            var actualToolFramework = actualToolSpec
                                      .TargetFrameworks
                                      .Single()
                                      .FrameworkName;

            Assert.Equal(CommonFrameworks.NetCoreApp10, actualToolFramework);

            var actualToolLibrary = actualToolSpec
                                    .TargetFrameworks
                                    .Single()
                                    .Dependencies
                                    .Single();

            Assert.Equal("Foo.Test.Tools", actualToolLibrary.Name);
            Assert.Equal("2.0.0", actualToolLibrary.LibraryRange.VersionRange.OriginalString);
        }
        private static void AssertError(DependencyGraphSpec spec, params string[] contains)
        {
            RestoreSpecException specEx = null;

            try
            {
                SpecValidationUtility.ValidateDependencySpec(spec);
            }
            catch (RestoreSpecException ex)
            {
                specEx = ex;
            }

            Assert.NotNull(specEx);

            foreach (var s in contains)
            {
                Assert.Contains(s, specEx.Message);
            }
        }
Beispiel #10
0
        public async Task VSSolutionRestoreService_VSRestoreSettingsUtilities_Integration(string restoreSources, string restoreAdditionalProjectSources, string expectedRestoreSources, string restoreFallbackFolders, string restoreAdditionalFallbackFolders, string expectedFallbackFolders)
        {
            var cps = NewCpsProject(@"{ }");
            var pri = cps.Builder
                      .WithTool("Foo.Test", "2.0.0")
                      .WithTargetFrameworkInfo(
                new VsTargetFrameworkInfo(
                    "netcoreapp2.0",
                    Enumerable.Empty <IVsReferenceItem>(),
                    Enumerable.Empty <IVsReferenceItem>(),
                    new[] { new VsProjectProperty("RestoreSources", restoreSources),
                            new VsProjectProperty("RestoreFallbackFolders", restoreFallbackFolders),
                            new VsProjectProperty("RestoreAdditionalProjectSources", restoreAdditionalProjectSources),
                            new VsProjectProperty("RestoreAdditionalProjectFallbackFolders", restoreAdditionalFallbackFolders) }))
                      .Build();
            var projectFullPath = cps.ProjectFullPath;

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, pri);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);

            var specSources = VSRestoreSettingsUtilities.GetSources(NullSettings.Instance, actualProjectSpec).Select(e => e.Source);

            var expectedSources = MSBuildStringUtility.Split(expectedRestoreSources);

            Assert.True(Enumerable.SequenceEqual(expectedSources.OrderBy(t => t), specSources.OrderBy(t => t)));

            var specFallback = VSRestoreSettingsUtilities.GetFallbackFolders(NullSettings.Instance, actualProjectSpec);

            var expectedFallback = MSBuildStringUtility.Split(expectedFallbackFolders);

            Assert.True(
                Enumerable.SequenceEqual(expectedFallback.OrderBy(t => t), specFallback.OrderBy(t => t)),
                "expected: " + string.Join(",", expectedFallback.ToArray()) + "\nactual: " + string.Join(",", specFallback.ToArray()));
        }
        public void SpecValidationUtility_VerifyProjectReferences_TFMLevel_Pass()
        {
            // Arrange
            var spec = GetBasicDG();

            spec.Projects.First().RestoreMetadata.TargetFrameworks.Add(new ProjectRestoreMetadataFrameworkInfo(NuGetFramework.Parse("net45")));

            spec.Projects.First().RestoreMetadata.TargetFrameworks.Single()
            .ProjectReferences.Add(new ProjectRestoreReference()
            {
                ProjectPath       = "b.csproj",
                ProjectUniqueName = "b"
            });

            spec.Projects.First().TargetFrameworks.First().Dependencies.Add(new LibraryDependency()
            {
                LibraryRange = new LibraryRange("b", LibraryDependencyTarget.PackageProjectExternal)
            });

            // Act && Assert no errors
            SpecValidationUtility.ValidateDependencySpec(spec);
        }
Beispiel #12
0
        public async Task NominateProjectAsync_WithValidPackageVersion()
        {
            const string projectJson     = @"{
    ""version"": ""1.2.0-beta1"",
    ""frameworks"": {
        ""netcoreapp1.0"": { }
    }
}";
            var          cps             = NewCpsProject(projectJson);
            var          projectFullPath = cps.ProjectFullPath;

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, cps.ProjectRestoreInfo);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);
            Assert.Equal("1.2.0-beta1", actualProjectSpec.Version.ToString());
        }
Beispiel #13
0
        public async Task NominateProjectAsync_PackageId()
        {
            var cps             = NewCpsProject("{ }");
            var projectFullPath = cps.ProjectFullPath;
            var pri             = cps.Builder
                                  .WithTargetFrameworkInfo(
                new VsTargetFrameworkInfo(
                    "netcoreapp1.0",
                    Enumerable.Empty <IVsReferenceItem>(),
                    Enumerable.Empty <IVsReferenceItem>(),
                    new[] { new VsProjectProperty("PackageId", "TestPackage") }))
                                  .Build();

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, cps.ProjectRestoreInfo);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);
            Assert.Equal("TestPackage", actualProjectSpec.Name);
        }
Beispiel #14
0
        public async Task NominateProjectAsync_CacheFilePathInPackageSpec_Succeeds()
        {
            var cps             = NewCpsProject("{ }");
            var projectFullPath = cps.ProjectFullPath;
            var pri             = cps.Builder
                                  .WithTargetFrameworkInfo(
                new VsTargetFrameworkInfo(
                    "netcoreapp1.0",
                    Enumerable.Empty <IVsReferenceItem>(),
                    Enumerable.Empty <IVsReferenceItem>(),
                    new IVsProjectProperty[] {}))
                                  .Build();

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, cps.ProjectRestoreInfo);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);
            Assert.Equal(Path.Combine(actualProjectSpec.RestoreMetadata.OutputPath, $"{Path.GetFileName(projectFullPath)}.nuget.cache"), actualProjectSpec.RestoreMetadata.CacheFilePath);
        }
Beispiel #15
0
        public async Task NominateProjectAsync_RestoreSettingsClear(string restorePackagesPath, string restoreSources, string fallbackFolders)
        {
            var cps             = NewCpsProject("{ }");
            var projectFullPath = cps.ProjectFullPath;
            var pri             = cps.Builder
                                  .WithTargetFrameworkInfo(
                new VsTargetFrameworkInfo(
                    "netcoreapp1.0",
                    Enumerable.Empty <IVsReferenceItem>(),
                    Enumerable.Empty <IVsReferenceItem>(),
                    new[] { new VsProjectProperty("RestorePackagesPath", restorePackagesPath),
                            new VsProjectProperty("RestoreSources", restoreSources),
                            new VsProjectProperty("RestoreFallbackFolders", fallbackFolders) }))
                                  .Build();

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, cps.ProjectRestoreInfo);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);
            Assert.Equal(restorePackagesPath, actualProjectSpec.RestoreMetadata.PackagesPath);

            var specSources     = actualProjectSpec.RestoreMetadata.Sources?.Select(e => e.Source);
            var expectedSources = MSBuildStringUtility.Split(restoreSources).Any(e => StringComparer.OrdinalIgnoreCase.Equals("clear", e)) ? new string[] { "Clear" } : MSBuildStringUtility.Split(restoreSources);

            Assert.True(Enumerable.SequenceEqual(expectedSources.OrderBy(t => t), specSources.OrderBy(t => t)));

            var specFallback     = actualProjectSpec.RestoreMetadata.FallbackFolders;
            var expectedFallback = MSBuildStringUtility.Split(fallbackFolders).Any(e => StringComparer.OrdinalIgnoreCase.Equals("clear", e)) ? new string[] { "Clear" } : MSBuildStringUtility.Split(fallbackFolders);

            Assert.True(Enumerable.SequenceEqual(expectedFallback.OrderBy(t => t), specFallback.OrderBy(t => t)));
        }
Beispiel #16
0
        public async Task NominateProjectAsync_WithRestoreAdditionalSourcesAndFallbackFolders(string restoreSources, string restoreAdditionalProjectSources, string restoreFallbackFolders, string restoreAdditionalFallbackFolders)
        {
            var cps = NewCpsProject(@"{ }");
            var pri = cps.Builder
                      .WithTool("Foo.Test", "2.0.0")
                      .WithTargetFrameworkInfo(
                new VsTargetFrameworkInfo(
                    "netcoreapp2.0",
                    Enumerable.Empty <IVsReferenceItem>(),
                    Enumerable.Empty <IVsReferenceItem>(),
                    new[] { new VsProjectProperty("RestoreSources", restoreSources),
                            new VsProjectProperty("RestoreFallbackFolders", restoreFallbackFolders),
                            new VsProjectProperty("RestoreAdditionalProjectSources", restoreAdditionalProjectSources),
                            new VsProjectProperty("RestoreAdditionalProjectFallbackFolders", restoreAdditionalFallbackFolders) }))
                      .Build();
            var projectFullPath = cps.ProjectFullPath;

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, pri);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);

            var specSources = actualProjectSpec.RestoreMetadata.Sources?.Select(e => e.Source);

            var expectedSources =
                (MSBuildStringUtility.Split(restoreSources).Any(e => StringComparer.OrdinalIgnoreCase.Equals("clear", e)) ?
                 new string[] { "Clear" } :
                 MSBuildStringUtility.Split(restoreSources)).
                Concat(
                    restoreAdditionalProjectSources != null ?
                    new List <string>()
            {
                VSRestoreSettingsUtilities.AdditionalValue
            }.Concat(MSBuildStringUtility.Split(restoreAdditionalProjectSources)):
                    new string[] { }
                    );

            Assert.True(Enumerable.SequenceEqual(expectedSources.OrderBy(t => t), specSources.OrderBy(t => t)));

            var specFallback = actualProjectSpec.RestoreMetadata.FallbackFolders;

            var expectedFallback =
                (MSBuildStringUtility.Split(restoreFallbackFolders).Any(e => StringComparer.OrdinalIgnoreCase.Equals("clear", e)) ?
                 new string[] { "Clear" } :
                 MSBuildStringUtility.Split(restoreFallbackFolders)).
                Concat(
                    restoreAdditionalFallbackFolders != null ?
                    new List <string>()
            {
                VSRestoreSettingsUtilities.AdditionalValue
            }.Concat(MSBuildStringUtility.Split(restoreAdditionalFallbackFolders)) :
                    new string[] { }
                    );

            Assert.True(
                Enumerable.SequenceEqual(expectedFallback.OrderBy(t => t), specFallback.OrderBy(t => t)),
                "expected: " + string.Join(",", expectedFallback.ToArray()) + "\nactual: " + string.Join(",", specFallback.ToArray()));
        }
Beispiel #17
0
        public async Task NominateProjectAsync_WithCliTool_RestoreSettings(
            string toolFramework, string restorePackagesPath, string restoreSources, string fallbackFolders)
        {
            var expectedToolFramework = NuGetFramework.Parse(toolFramework);

            var cps = NewCpsProject(@"{ }");
            var pri = cps.Builder
                      .WithTool("Foo.Test.Tools", "2.0.0")
                      .WithTargetFrameworkInfo(
                new VsTargetFrameworkInfo(
                    "netcoreapp2.0",
                    Enumerable.Empty <IVsReferenceItem>(),
                    Enumerable.Empty <IVsReferenceItem>(),
                    new[] { new VsProjectProperty("RestorePackagesPath", restorePackagesPath),
                            new VsProjectProperty("RestoreSources", restoreSources),
                            new VsProjectProperty("RestoreFallbackFolders", fallbackFolders),
                            new VsProjectProperty("DotnetCliToolTargetFramework", toolFramework) }))
                      .Build();
            var projectFullPath = cps.ProjectFullPath;

            // Act
            var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, pri);

            // Assert
            SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec);

            var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath);

            Assert.NotNull(actualProjectSpec);

            var actualToolSpec = actualRestoreSpec
                                 .Projects
                                 .Where(p => !object.ReferenceEquals(p, actualProjectSpec))
                                 .Single();
            var actualMetadata = actualToolSpec.RestoreMetadata;

            Assert.NotNull(actualMetadata);
            Assert.Equal(projectFullPath, actualMetadata.ProjectPath);
            Assert.Equal(ProjectStyle.DotnetCliTool, actualMetadata.ProjectStyle);
            Assert.Null(actualMetadata.OutputPath);

            var actualToolFramework = actualToolSpec
                                      .TargetFrameworks
                                      .Single()
                                      .FrameworkName;

            Assert.Equal(expectedToolFramework, actualToolFramework);

            var actualToolLibrary = actualToolSpec
                                    .TargetFrameworks
                                    .Single()
                                    .Dependencies
                                    .Single();

            Assert.Equal("Foo.Test.Tools", actualToolLibrary.Name);
            Assert.Equal("2.0.0", actualToolLibrary.LibraryRange.VersionRange.OriginalString);

            Assert.Equal(restorePackagesPath, actualToolSpec.RestoreMetadata.PackagesPath);

            var specSources     = actualToolSpec.RestoreMetadata.Sources?.Select(e => e.Source);
            var expectedSources = MSBuildStringUtility.Split(restoreSources);

            Assert.True(Enumerable.SequenceEqual(expectedSources.OrderBy(t => t), specSources.OrderBy(t => t)));

            var specFallback     = actualToolSpec.RestoreMetadata.FallbackFolders;
            var expectedFallback = MSBuildStringUtility.Split(fallbackFolders);

            Assert.True(Enumerable.SequenceEqual(expectedFallback.OrderBy(t => t), specFallback.OrderBy(t => t)));
        }