Improve sln migration tests (#5066)
* WIP Improve sln migration tests * Simple migration test * Improve the test * WIP update test assets * Update test * Test a bug fix * Add another migrate sln test * Fix FilePath related tests * Finish the migrate sln tests * Fix tests * Fix another path issue
This commit is contained in:
parent
7a2c6ad086
commit
89f0b05958
45 changed files with 690 additions and 65 deletions
|
@ -134,7 +134,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
var projectName = migrationRuleInputs.DefaultProjectContext.GetProjectName();
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
if (IsMigrated(migrationSettings, migrationRuleInputs))
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.SkipMigrationAlreadyMigrated, nameof(ProjectMigrator), migrationSettings.ProjectDirectory));
|
||||
|
@ -156,9 +156,34 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
|
||||
return new ProjectMigrationReport(migrationSettings.ProjectDirectory, projectName, error, null);
|
||||
}
|
||||
|
||||
|
||||
List<string> csprojDependencies = null;
|
||||
if (migrationRuleInputs.ProjectXproj != null)
|
||||
{
|
||||
var projectDependencyFinder = new ProjectDependencyFinder();
|
||||
var dependencies = projectDependencyFinder.ResolveXProjProjectDependencies(
|
||||
migrationRuleInputs.ProjectXproj);
|
||||
|
||||
if (dependencies.Any())
|
||||
{
|
||||
csprojDependencies = dependencies
|
||||
.SelectMany(r => r.Includes().Select(p => PathUtility.GetPathWithDirectorySeparator(p)))
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
csprojDependencies = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
var outputProject = Path.Combine(migrationSettings.OutputDirectory, projectName + ".csproj");
|
||||
return new ProjectMigrationReport(migrationSettings.ProjectDirectory, projectName, outputProject, null);
|
||||
return new ProjectMigrationReport(
|
||||
migrationSettings.ProjectDirectory,
|
||||
projectName,
|
||||
outputProject,
|
||||
null,
|
||||
null,
|
||||
csprojDependencies);
|
||||
}
|
||||
|
||||
private MigrationRuleInputs ComputeMigrationRuleInputs(MigrationSettings migrationSettings)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue