internal static void GetOutputFilePaths(PackageSpec packageSpec, out string assetsFilePath, out string cacheFilePath, out string targetsFilePath, out string propsFilePath, out string lockFilePath)
 {
     assetsFilePath  = GetAssetsFilePath(packageSpec);
     cacheFilePath   = NoOpRestoreUtilities.GetProjectCacheFilePath(packageSpec.RestoreMetadata.OutputPath);
     targetsFilePath = BuildAssetsUtils.GetMSBuildFilePath(packageSpec, BuildAssetsUtils.TargetsExtension);
     propsFilePath   = BuildAssetsUtils.GetMSBuildFilePath(packageSpec, BuildAssetsUtils.PropsExtension);
     lockFilePath    = packageSpec.RestoreMetadata.ProjectStyle == ProjectStyle.PackageReference ?
                       PackagesLockFileUtilities.GetNuGetLockFilePath(packageSpec) :
                       null;
 }
        public async Task RestoreAsync_WithProgressReporter_WhenFilesAreWriten_ProgressIsReported()
        {
            // Arrange
            using var pathContext = new SimpleTestPathContext();
            var settings         = Settings.LoadDefaultSettings(pathContext.SolutionRoot);
            var packageSpec      = ProjectTestHelpers.GetPackageSpec(settings, projectName: "projectName", rootPath: pathContext.SolutionRoot);
            var progressReporter = new Mock <IRestoreProgressReporter>();

            // Act
            IReadOnlyList <RestoreSummary> result = await DependencyGraphRestoreUtility.RestoreAsync(
                ProjectTestHelpers.GetDGSpecFromPackageSpecs(packageSpec),
                new DependencyGraphCacheContext(),
                new RestoreCommandProvidersCache(),
                cacheContextModifier : _ => { },
                sources : new SourceRepository[0],
                parentId : Guid.Empty,
                forceRestore : false,
                isRestoreOriginalAction : true,
                additionalMessages : null,
                progressReporter : progressReporter.Object,
                new TestLogger(),
                CancellationToken.None);

            // Assert
            result.Should().HaveCount(1);
            RestoreSummary restoreSummary = result[0];

            restoreSummary.Success.Should().BeTrue();
            restoreSummary.NoOpRestore.Should().BeFalse();
            var assetsFilePath = Path.Combine(packageSpec.RestoreMetadata.OutputPath, LockFileFormat.AssetsFileName);

            File.Exists(assetsFilePath).Should().BeTrue(because: $"{assetsFilePath}");

            var propsFile   = BuildAssetsUtils.GetMSBuildFilePath(packageSpec, BuildAssetsUtils.PropsExtension);
            var targetsFile = BuildAssetsUtils.GetMSBuildFilePath(packageSpec, BuildAssetsUtils.TargetsExtension);

            IReadOnlyList <string> expectedFileList = new string[] { assetsFilePath, propsFile, targetsFile };
            var pathComparer = PathUtility.GetStringComparerBasedOnOS();

            progressReporter.Verify(r =>
                                    r.StartProjectUpdate(
                                        It.Is <string>(e => e.Equals(packageSpec.FilePath)),
                                        It.Is <IReadOnlyList <string> >(e => e.OrderedEquals(expectedFileList, (f) => f, pathComparer, pathComparer))),
                                    Times.Once);
            progressReporter.Verify(r =>
                                    r.EndProjectUpdate(
                                        It.Is <string>(e => e.Equals(packageSpec.FilePath)),
                                        It.Is <IReadOnlyList <string> >(e => e.OrderedEquals(expectedFileList, (f) => f, pathComparer, pathComparer))),
                                    Times.Once);
        }