public static bool VerifyClonedFileSystemStructure(FileSystemSite source, FileSystemSite destination, IStringlyTypedPathOperator stringlyTypedPathOperator, TextWriter writer) { var sourcePaths = source.FileSystemOperator.EnumerateFileSystemEntryPaths(source.DirectoryPath, true); var sourceRelativePaths = sourcePaths.Select(path => stringlyTypedPathOperator.GetRelativePath(source.DirectoryPath, path)); var expectedDestinationPaths = sourceRelativePaths.Select(path => stringlyTypedPathOperator.Combine(destination.DirectoryPath, path)); var actualDestinationPaths = destination.FileSystemOperator.EnumerateFileSystemEntryPaths(destination.DirectoryPath, true); var output = true; var missingDestinationPaths = expectedDestinationPaths.Except(actualDestinationPaths); if (missingDestinationPaths.Count() > 0) { output = false; writer.WriteLine($"Paths missing (count: {missingDestinationPaths.Count()}):"); foreach (var missingDestinationPath in missingDestinationPaths) { writer.WriteLine(missingDestinationPath); } } return(output); }
/// <summary> /// Performs special solution directory path-relative formatting. /// </summary> public static string GetProjectFilePath(this IStringlyTypedPathOperator stringlyTypedPathOperator, string solutionFilePath, string projectFileRelativePath) { var solutionFileDirectoryPath = stringlyTypedPathOperator.GetDirectoryPathForFilePath(solutionFilePath); var projectFilePath = stringlyTypedPathOperator.Combine(solutionFileDirectoryPath, projectFileRelativePath); return(projectFilePath); }